Tim and Gabriel,

Thank you so much. I was able to find and remove the special character from the 
line below and another one after it.
The error has now gone away.

Thanks also for the chdir solution, though I did not need it this time. The fix 
above was exactly what it needed to work.

I have my utilities chugging along again - What a relief!

Thanks again.

Sandipan

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Gabriel Genellina
Sent: Tuesday, September 04, 2007 3:27 PM
To: python-list@python.org
Subject: Re: Setting Current Dir in Python

En Tue, 04 Sep 2007 09:12:22 -0300, Sandipan Gangopadhyay  
<[EMAIL PROTECTED]> escribi�:

> I have recently installed Python 2.5.1 and Pythonwin (without any  
> errors) on
> Windows Vista Ultimate.
>
> Now, the programs run fine within Pythonwin IDE when current directory is
> set to the program's directory.
>
> But, when I double click them from Windows Explorer, the program is not  
> run.

First, fix your source code (either removing the non-ascii character or  
adding an encoding line at the top, see  
<http://www.python.org/peps/pep-0263.html>) (PEP0263 is enforced from  
Python 2.5 and up; you got a warning on earlier versions).

os.getcwd() returns the current directory.
os.chdir() changes the current directory.
A shortcut on the desktop may use the desktop itself as the initial  
directory.
If you want to run your script from within the same directory as it  
resides, try this:
os.chdir(os.path.dirname(__file__))


-- 
Gabriel Genellina

-- 
http://mail.python.org/mailman/listinfo/python-list


-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to