Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Mar 30th, 2005, 11:28 AM   #1
nappaji
Newbie
 
Join Date: Mar 2005
Posts: 1
Rep Power: 0 nappaji is on a distinguished road
python modules

All, I am new to Python and am trying out a few code samples.
When I start Python commandline, it gives me a >>> prompt.
Can't I cd onto another directory where my script resides from the >>> prompt? I tried doing it and it does not like it.

How do I cd to this directory from my prompt? Or is it not possible?

Basically I want to do a import command from the >>> prompt.

Thanks
nappaji is offline   Reply With Quote
Old Mar 30th, 2005, 2:09 PM   #2
pientra
Newbie
 
Join Date: Mar 2005
Posts: 1
Rep Power: 0 pientra is on a distinguished road
As far as I know about changing the directory within the Python interpreter isn't possible.

The solution to this is to be in the working directory where your script is located. Don't quote me on this though.
__________________
Don't just stand there, kill him!
pientra is offline   Reply With Quote
Old Mar 30th, 2005, 3:53 PM   #3
al1986
Newbie
 
Join Date: Feb 2005
Posts: 24
Rep Power: 0 al1986 is on a distinguished road
You can change the current working directory by doing
>>> import os
>>> os.chdir(path)

Changing directory shouldn't be necessary, though. Try adding the directory in which
your module resides to the PYTHONPATH environment variable.
al1986 is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 7:45 PM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC