By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,660 Members | 1,102 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,660 IT Pros & Developers. It's quick & easy.

IDLE Path doesn't include current dir after chdir

P: n/a
I'm trying to learn more Python and have come across a strange
behavior.
I have Python2.3 installed on a Win2K machine. If I start the python
command line, I can do the following:
Python 2.3.2 (#49, Oct 2 2003, 20:02:00) [MSC v.1200 32 bit (Intel)]
on win32
Type "help", "copyright", "credits" or "license" for more information.
import os
os.getcwd() 'C:\\Python23' os.chdir('d:\\python')
os.getcwd() 'd:\\python' import fibo
## fibo is fibonacci example from tutorial.
Everything works fine. But with IDLE, I get the following:

Python 2.3.2 (#49, Oct 2 2003, 20:02:00) [MSC v.1200 32 bit (Intel)]
on win32
Type "copyright", "credits" or "license()" for more information.

************************************************** **************
Personal firewall software may warn about the connection IDLE
makes to its subprocess using this computer's internal loopback
interface. This connection is not visible on any external
interface and no data is sent to or received from the Internet.
************************************************** **************

IDLE 1.0 import os
os.getcwd() 'C:\\Python23' os.chdir('d:\\python')
os.getcwd() 'd:\\python' import fibo
Traceback (most recent call last):
File "<pyshell#5>", line 1, in -toplevel-
import fibo
ImportError: No module named fibo

When I use a desktop shortcut that has my start directory as
d:\python rather than the default, I can import my modules and things
work reasonably. I get the same "can't find module" result from
wxPython's PyAlaMode shell.
I dug a little and found that sys.path in idle doesn't seem to contain
".", when I manually added it, import behaves itself in idle after
chdir, but I don't want to have to manually fix my path every time I
start up. Anyone have more insight or a fix?
Thanks,
Tom McDavid
Jul 18 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.