[Tutor] How to change the working directory in IDLE

2009-06-16 Thread Elisha Rosensweig
Hi Tutors,

Im using Python 2.6.2 and the IDLE tool (also v. 2.6.2). However, when I
open the editor I cannot seem to change the directory so as to allow for
easy access to my modules. So, for example, the following occurs:


os.chdir('/Users/elisha/Documents/workspace/CacheNetFramework/src/Tests')
 os.getcwd()
'/Users/elisha/Documents/workspace/CacheNetFramework/src/Tests'
 import CSITest

Traceback (most recent call last):
  File pyshell#9, line 1, in module
import CSITest
ImportError: No module named CSITest


What am I doing wrong?

Thanks

Elisha
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] How to change the working directory in IDLE

2009-06-16 Thread Martin Walsh
Martin Walsh wrote:
 Elisha Rosensweig wrote:
 Hi Tutors,

 Im using Python 2.6.2 and the IDLE tool (also v. 2.6.2). However, when
 I open the editor I cannot seem to change the directory so as to allow
 for easy access to my modules. So, for example, the following occurs:

 os.chdir('/Users/elisha/Documents/workspace/CacheNetFramework/src/Tests')
 os.getcwd()
 '/Users/elisha/Documents/workspace/CacheNetFramework/src/Tests'
 import CSITest
 Traceback (most recent call last):
   File pyshell#9, line 1, in module
 import CSITest
 ImportError: No module named CSITest


 What am I doing wrong?
 
 http://docs.python.org/tutorial/modules.html#the-module-search-path
 
 You probably want to append to sys.path in your script, or to the
 PYTHONPATH environment variable, instead of using os.chdir.

Sorry, 'in your script' should read something like 'in Idle'. Here's
another doc reference.

http://docs.python.org/tutorial/modules.html#tut-standardmodules

 
 import sys
 sys.path.append('/Users/elisha/Documents/workspace/CacheNetFramework/src/Tests')
 
 import CSITest
 
 HTH,
 Marty

___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor