Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > cz.comp.lang.python > #3381

Re: [python] vytváření souboru

Path csiph.com!newsfeed.xs4all.nl!newsfeed7.news.xs4all.nl!85.12.16.68.MISMATCH!peer01.ams1!peer.ams1.xlned.com!news.xlned.com!peer03.am4!peer.am4.highwinds-media.com!news.highwinds-media.com!fx12.am4.POSTED!not-for-mail
Received-SPF none (Address does not pass the Sender Policy Framework) SPF=HELO; sender=mxb1.seznam.cz; remoteip=::ffff:77.75.78.89; remotehost=; helo=mxb1.seznam.cz; receiver=hugo.zagamma.cz;
Received-SPF pass (Address passes the Sender Policy Framework) SPF=MAILFROM; sender=zu1234@seznam.cz; remoteip=::ffff:77.75.78.89; remotehost=; helo=mxb1.seznam.cz; receiver=hugo.zagamma.cz;
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=seznam.cz; s=beta; t=1569312716; bh=huiFvH+IPMUegMhbB/ZcWLdpD8xNaUF2mzT5wcC6vPQ=; h=Received:Subject:To:References:From:Message-ID:Date:User-Agent: MIME-Version:In-Reply-To:Content-Type:Content-Transfer-Encoding: Content-Language; b=Nn8tcgAJxDjbgqwjWmDvb23O0yz4fsa5vTRtN5aPV8aYNShtScnsBKG/rltYjN43i 66bj1ce9CuV6hSv1VNUcYFbvx+US5alXh6iV9j4WoopjC+WC4pSOZk095grduplkAP KSO8eC5vbWUvxHu1ANKRTdF99Y5QC75A3LRLNXJc=
From zu1234 <zu1234@seznam.cz>
User-Agent Mozilla/5.0 (Windows NT 10.0; rv:60.0) Gecko/20100101 Thunderbird/60.9.0
MIME-Version 1.0
In-Reply-To <20190924095125.Horde.ArfoAgwCccP5n0kbrDajUMt@webmail.inetadmin.eu>
Content-Type text/plain; charset=iso-8859-2; format=flowed
Content-Transfer-Encoding 8bit
Content-Language cs
Subject Re: [python] vytváření souboru
X-BeenThere python@py.cz
X-Mailman-Version 2.1.29
Precedence list
List-Id Konference PyCZ <python.py.cz>
List-Unsubscribe <http://www.py.cz/mailman/options/python>, <mailto:python-request@py.cz?subject=unsubscribe>
List-Archive <http://www.py.cz/pipermail/python/>
List-Post <mailto:python@py.cz>
List-Help <mailto:python-request@py.cz?subject=help>
List-Subscribe <http://www.py.cz/mailman/listinfo/python>, <mailto:python-request@py.cz?subject=subscribe>
Newsgroups cz.comp.lang.python
Message-ID <mailman.43.1569312719.5720.python@py.cz> (permalink)
X-Mailman-Original-Message-ID <d54a9849-6878-8af2-c13a-ddeab32e48ef@seznam.cz>
X-Mailman-Original-References <0d7f5d45-81fd-04bc-f481-76f54f6fff52@seznam.cz> <CAK9Q5BSPewM-BLCE1YgO1+v--0mAzfWAhcsXkN9uDaW5UPNxGQ@mail.gmail.com> <62ca6b0a-ad53-0b41-da46-04c192b51813@seznam.cz> <CAK9Q5BTLHiRrh1zXMMXW4KKHxLnN_WR1P9DzFh_B2FdWKB5gBg@mail.gmail.com> <91e6e1de-783c-204a-e623-142dfb2174d8@seznam.cz> <d34b5ea8-8b38-f92e-4d7d-73a3bb5a8bfd@atlas.cz> <d9cb4358-5461-0540-4a38-a76952ee0f8e@seznam.cz> <20190924095125.Horde.ArfoAgwCccP5n0kbrDajUMt@webmail.inetadmin.eu>
References <0d7f5d45-81fd-04bc-f481-76f54f6fff52@seznam.cz> <CAK9Q5BSPewM-BLCE1YgO1+v--0mAzfWAhcsXkN9uDaW5UPNxGQ@mail.gmail.com> <62ca6b0a-ad53-0b41-da46-04c192b51813@seznam.cz> <CAK9Q5BTLHiRrh1zXMMXW4KKHxLnN_WR1P9DzFh_B2FdWKB5gBg@mail.gmail.com> <91e6e1de-783c-204a-e623-142dfb2174d8@seznam.cz> <d34b5ea8-8b38-f92e-4d7d-73a3bb5a8bfd@atlas.cz> <d9cb4358-5461-0540-4a38-a76952ee0f8e@seznam.cz> <20190924095125.Horde.ArfoAgwCccP5n0kbrDajUMt@webmail.inetadmin.eu> <d54a9849-6878-8af2-c13a-ddeab32e48ef@seznam.cz>
Lines 178
X-Complaints-To abuse@usenet-news.net
NNTP-Posting-Date Tue, 24 Sep 2019 08:11:59 UTC
Organization usenet-news.net
Date Tue, 24 Sep 2019 10:11:51 +0200
X-Received-Bytes 9009
X-Received-Body-CRC 1922450675
Xref csiph.com cz.comp.lang.python:3381

Show key headers only | View raw


Je to vybalování ZIP archivu:
            CHUNK = 65536
             with file(FFN_OUT, 'wb') as FI:
                 with ZIP.open(FN_ZIP, 'r') as FI_OF_ZIP:
                     while True:
                         PART = FI_OF_ZIP.read(CHUNK)
                         if not PART:
                             break
                         else:
                             FI.write(PART)


Dne 24.9.2019 v 9:51 azurit@pobox.sk napsal(a):
> A ako robis ten zapis 'po castiach'? Subor zavries a znovu otvoris? Ak 
> ano, skusal si miesto toho urobit flush()?
>
>
>
>
>
> Citát zu1234 <zu1234@seznam.cz>:
>
>> Myslím že to není můj případ:
>> Soubor byl otevřen jednoduše, tedy předpokládám buffrovaně:
>> with file(FFN_OUT, 'wb') as FI:
>>
>> Soubor nebyl tlačen po síti, byl umístěn lokálně na C: .
>>
>> Děkuji za zájem.
>> Z vašich reakcí vyplývá že jsem asi neudělal žádnou primitivní chybu, 
>> jen jsem prostě šlápl mimo dálnici.
>>
>> Dne 24.9.2019 v 8:13 mtip napsal(a):
>>> A neukládal si to po netu?
>>>
>>> On x86 (32-bit) or IA64 (64-bit) systems, the maximum buffer size is 
>>> just under 64MB. For X64 systems, the maximum buffer size is just 
>>> under 32MB.
>>> The maximum unbuffered read and write size limits are imposed by the 
>>> design of the IO manager inside the Windows executive.
>>> When an application reads or writes files that are opened with 
>>> FILE_FLAG_NO_BUFFERING,
>>> the IO Manager locks the application's buffer into physical RAM and 
>>> then maps the virtual addresses into physical addresses
>>> to pass to the disk device by making a memory descriptor list (MDL).
>>> The buffer size limitation comes from the maximum size MDL that the 
>>> IO Manager will create.
>>> The reason for the difference between platforms is the way the 
>>> maximum buffer size is calculated from the memory page size and 
>>> pointer size.
>>> The IO Manager uses the following formula to compute the maximum 
>>> size MDL:
>>>
>>> ((65535 - sizeof(MDL)) / sizeof(ULONG_PTR)) * PAGE_SIZE
>>>
>>> This formula has the following results:
>>>
>>> Processor Page Size Pointer Size MDL calculation
>>> ======== ======== ========= =============
>>>
>>> x86 (32-bit) 4096 4 bytes ((65535 - 28) / 4) * 4096 = 67076096 bytes 
>>> (63.97 MB)
>>>
>>> IA64 8096 8 bytes ((65535 - 48) / 8) * 8192 = 67051520 bytes (63.95 MB)
>>>
>>> X64 4096 8 bytes ((65535 - 48) / 8) * 4096 = 33525760 bytes (32MB - 
>>> 28K)
>>>
>>> This limitation occurs when the file is opened with 
>>> FILE_FLAG_NO_BUFFERING.
>>>
>>> Dne 23.09.2019 v 16:43 zu1234 napsal(a):
>>>> W10 prof 32 bit
>>>> Filesystém NTFS
>>>> Python 2.7.15
>>>> Opakuji: pokud soubor zapisuju po částech, tak bez problému.
>>>> Znovu jsem to zkoušel zapsat vcelku: neprošlo cca 100MB.
>>>>
>>>> Dne 23.9.2019 v 16:14 Petr Messner napsal(a):
>>>>> Na jakém systému? Linux?
>>>>>
>>>>> Nezapisoval jsi soubor větší než 4 GB na FAT32?
>>>>>
>>>>> Nezapisoval jsi do souboru otevřeném jen pro čtení?
>>>>>
>>>>> Nejsi na 32bit systému, nebo nemáš spuštěný 32bit Python?
>>>>>
>>>>> Jen tak na zkoušku jsem si v Pythonu 3 zkusil jedním write zapsat 
>>>>> 20GB soubor, bez problému.
>>>>>
>>>>> PM
>>>>>
>>>>> po 23. 9. 2019 v 15:59 odesílatel zu1234 <zu1234@seznam.cz 
>>>>> <mailto:zu1234@seznam.cz>> napsal:
>>>>>
>>>>>     IOError, 22, Invalid argument
>>>>>
>>>>>
>>>>>
>>>>>     Dne 23.9.2019 v 13:10 Petr Messner napsal(a):
>>>>>>     A jaký byl text toho IOError? To, že to nic neříká tobě, 
>>>>>> neznamená, že to nevysvětluje tu chybu :)
>>>>>>
>>>>>>     file.write je high level metoda, která volá OS syscall write 
>>>>>> tolikrát, kolik je potřeba, takže teoreticky jsi omezený jen 
>>>>>> velikostí RAM.
>>>>>>
>>>>>>     PM
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>     po 23. 9. 2019 v 11:43 odesílatel zu1234 <zu1234@seznam.cz 
>>>>>> <mailto:zu1234@seznam.cz>> napsal:
>>>>>>
>>>>>>         Při vytváření (binárního) souboru pomocí file.write() 
>>>>>> jsem se utkal s
>>>>>>         nic neříkající chybou io error ... .
>>>>>>         Nakonec jsem zjistit že větší soubor je nutno zapisovat 
>>>>>> po částech a ne
>>>>>>         naráz.
>>>>>>         Nenašel jsem jak zjistit jak největší může ta část být.
>>>>>>         Program funguje, ale chtěl bych vědět víc.
>>>>>>         Orientuje se někdo lépe?
>>>>>>         Díky ZU
>>>>>>
>>>>>>
>>>>>>         _______________________________________________
>>>>>>         Python mailing list
>>>>>>         python@py.cz <mailto:python@py.cz>
>>>>>>         http://www.py.cz/mailman/listinfo/python
>>>>>>
>>>>>>         Visit: http://www.py.cz
>>>>>>
>>>>>>
>>>>>>     _______________________________________________
>>>>>>     Python mailing list
>>>>>>     python@py.cz <mailto:python@py.cz>
>>>>>>     http://www.py.cz/mailman/listinfo/python
>>>>>>
>>>>>>     Visit: http://www.py.cz
>>>>>
>>>>
>>>> _______________________________________________
>>>> Python mailing list
>>>> python@py.cz
>>>> http://www.py.cz/mailman/listinfo/python
>>>>
>>>> Visit: http://www.py.cz
>>>>
>>> _______________________________________________
>>> Python mailing list
>>> python@py.cz
>>> http://www.py.cz/mailman/listinfo/python
>>>
>>> Visit: http://www.py.cz
>>
>>
>> _______________________________________________
>> Python mailing list
>> python@py.cz
>> http://www.py.cz/mailman/listinfo/python
>>
>> Visit: http://www.py.cz
>
>
>
> _______________________________________________
> Python mailing list
> python@py.cz
> http://www.py.cz/mailman/listinfo/python
>
> Visit: http://www.py.cz

Back to cz.comp.lang.python | Previous | Next | Find similar


Thread

Re: [python] vytváření souboru zu1234 <zu1234@seznam.cz> - 2019-09-24 10:11 +0200

csiph-web