[python-win32] python-win32 Digest, Vol 74, Issue 5

Mike Driscoll mdriscoll at co.marshall.ia.us
Mon May 4 16:18:39 CEST 2009


python-win32-request at python.org wrote:
> Send python-win32 mailing list submissions to
> 	python-win32 at python.org
>
> To subscribe or unsubscribe via the World Wide Web, visit
> 	http://mail.python.org/mailman/listinfo/python-win32
> or, via email, send a message with subject or body 'help' to
> 	python-win32-request at python.org
>
> You can reach the person managing the list at
> 	python-win32-owner at python.org
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of python-win32 digest..."
>   
> ------------------------------------------------------------------------
>
> Today's Topics:
>
>    1. Re: Modify only the first line of a big file (Roughly 1.5MB -
>       For thousands of file). (Robert)
>    2. Re: Modify only the first line of a big file	(Roughly 1.5MB -
>       For thousands of file). (Gerdus van Zyl)
>    3. Python Windows MSI installs now fails with error	2755...
>       (J. Marc Edwards)
>   
>
> ------------------------------------------------------------------------
>
> Subject:
> Re: [python-win32] Modify only the first line of a big file (Roughly 
> 1.5MB - For thousands of file).
> From:
> Robert <kxroberto at googlemail.com>
> Date:
> Sun, 03 May 2009 13:01:27 +0200
> To:
> python-win32 at python.org
>
> To:
> python-win32 at python.org
>
>
> Khalid Moulfi wrote:
>> Hi all,
>>  
>> I have thousands of file and I must update only the first line.
>> My concern is : is it possible to read only the first line for each 
>> of these files and update the first line only without reading the 
>> file completely ?
>>  
>> Version of Python is 2.2.1
>>  
>> Thanks for any help,
>>  
>
> when the length of the line/initial bytes doesn't change (by means of 
> enough balancing spaces or so) you can open the file in "r+" mode and 
> overwrite sections; e.g. after reading some bytes/line or so do 
> f.seek(0) and overwrite the initial bytes.
>
>
>
>
> ------------------------------------------------------------------------
>
> Subject:
> Re: [python-win32] Modify only the first line of a big file (Roughly 
> 1.5MB - For thousands of file).
> From:
> Gerdus van Zyl <gerdusvanzyl at gmail.com>
> Date:
> Sun, 3 May 2009 16:02:52 +0200
> To:
> python-win32 at python.org
>
> To:
> python-win32 at python.org
>
>
> It seems it's not possible if as mentioned you aren't replacing a line
> with a line of the same lenght/bytes. You then have to resort to using
> intermediate files see: http://python.pastebin.com/f539b4e46
>
> On Sun, May 3, 2009 at 1:01 PM, Robert <kxroberto at googlemail.com> wrote:
>   
>> Khalid Moulfi wrote:
>>     
>>> Hi all,
>>>  I have thousands of file and I must update only the first line.
>>> My concern is : is it possible to read only the first line for each of
>>> these files and update the first line only without reading the file
>>> completely ?
>>>  Version of Python is 2.2.1
>>>  Thanks for any help,
>>>
>>>       
>> when the length of the line/initial bytes doesn't change (by means of enough
>> balancing spaces or so) you can open the file in "r+" mode and overwrite
>> sections; e.g. after reading some bytes/line or so do f.seek(0) and
>> overwrite the initial bytes.
>>
>>
>> _______________________________________________
>> python-win32 mailing list
>> python-win32 at python.org
>> http://mail.python.org/mailman/listinfo/python-win32
>>
>>     
>
>   
>
> ------------------------------------------------------------------------
>
> Subject:
> [python-win32] Python Windows MSI installs now fails with error 2755...
> From:
> "J. Marc Edwards" <jmarcedwards at gmail.com>
> Date:
> Sun, 3 May 2009 16:15:01 -0400
> To:
> <python-win32 at python.org>
>
> To:
> <python-win32 at python.org>
>
>
> I am a new Python user.  I was experimenting with a variety of Python 
> versions on Windows XP, e.g. 2.6.2, 3.0.1, ActiveState 2.6.2/3.0.1, etc.
>
>  
>
> I then also wanted to start using iPython, which I also installed on 
> my Windows XP system.
>
>  
>
> I am also an emacs user, so I was trying to get the Python pdb 
> debugger to work with emacs, but I was having problems that seemed to 
> point to having multiple Python versions on my system.
>
>  
>
> So, I wanted to then "clean" my system up from all the Python versions.
>
>  
>
> After removing all of my Python versions, I then tried to re-install 
> just Python 2.6.2.
>
>  
>
> However, I am now receiving an error message from the Windows MSI 
> installer that says:
>
>  
>
> *"The system cannot open the device or file specified."*
>
>  
>
> And then a windowed message:
>
>  
>
> *"The installer has encountered an unexpected error installing this 
> package.  This may indicate a problem with this package.  The error 
> code is 2755."*
>
>  
>
> Now I can't install any of the previous Python packages on my Windows 
> laptop.
>
>  
>
> I have tried researching this on the Internet, and it seems to 
> indicate a Windows registry error point to an incomplete uninstall of 
> an application, notably the previous Python versions that I had on my 
> system.
>
>  
>
> Does anyone know how I could clean up the registry so that I can 
> successfully reinstall Python?
>
>  
>
> Many thanks in advance, Marc
>
>  
>

One way to go about it would be to back up your registry and then open 
regedit and do a search for the term "python". Then delete those keys or 
values that obviously shouldn't be in there anymore. If you're cautious 
and use common sense, you can muck around in the registry without 
harming your PC. Just don't start deleting willy nilly or you will make 
your PC unstable.

Mike


More information about the python-win32 mailing list