Martin Walsh wrote: > Elisha Rosensweig wrote: >> Hi Tutors, >> >> I"m 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