on my system(win2k server, python 2.3.5), import sys print sys.path
['C:\\', 'C:\\WINNT\\system32\\python23.zip',
'C:\\Python23\\lib\\site-packages\\Pythonwin',
'C:\\Python23\\lib\\site-packages\\win32',
'C:\\Python23\\lib\\site-packages\\win32\\lib',
'C:\\Python23\\lib\\site-packages', 'C:\\Python23\\DLLs',
'C:\\Python23\\lib', 'C:\\Python23\\lib\\plat-win',
'C:\\Python23\\lib\\lib-tk', 'C:\\Python23', 'D:\\Program Files\\DeLano
Scientific\\PyMOL\\modules']
now, i wanna add "C:\Python23\Pmw\Pmw_1_2\lib" into sys.path, how?
any help would be appreciated.
with my kind regards,
Wen 10 12793
You can do it this way:
sys.path.append("C:\Temp")
Alejandro
wen wrote: on my system(win2k server, python 2.3.5),
import sys print sys.path ['C:\\', 'C:\\WINNT\\system32\\python23.zip', 'C:\\Python23\\lib\\site-packages\\Pythonwin', 'C:\\Python23\\lib\\site-packages\\win32', 'C:\\Python23\\lib\\site-packages\\win32\\lib', 'C:\\Python23\\lib\\site-packages', 'C:\\Python23\\DLLs', 'C:\\Python23\\lib', 'C:\\Python23\\lib\\plat-win', 'C:\\Python23\\lib\\lib-tk', 'C:\\Python23', 'D:\\Program Files\\DeLano Scientific\\PyMOL\\modules']
now, i wanna add "C:\Python23\Pmw\Pmw_1_2\lib" into sys.path, how?
any help would be appreciated.
hint 1: Python lists have an append() and an insert() method
hint 2: sys.path is a list
HTH
--
bruno desthuilliers
python -c "print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for
p in 'o****@xiludom.gro'.split('@')])"
if i wanna add the path "C:\temp" into sys.path, and make it available for
any other new python apps, like i add C:\temp into windows path , how?
thank you.
"apa" <ap******@gmail.com> wrote in message
news:11**********************@o13g2000cwo.googlegr oups.com... You can do it this way:
sys.path.append("C:\Temp")
Alejandro
wen wrote: if i wanna add the path "C:\temp" into sys.path, and make it available for any other new python apps, like i add C:\temp into windows path , how? thank you.
Then use PYTHONPATH as you would use PATH .....
if i wanna add the path "C:\temp" into sys.path, and make it available for
any other new python apps, like i add C:\temp into windows path , how?
thank you.
"apa" <ap******@gmail.com> wrote in message
news:11**********************@o13g2000cwo.googlegr oups.com... You can do it this way:
sys.path.append("C:\Temp")
Alejandro
apa wrote: You can do it this way:
sys.path.append("C:\Temp")
Alejandro
Better:
sys.path.append("C:\\Temp")
or
sys.path.append(r"C:\Temp")
regards
Steve
--
Steve Holden +44 150 684 7255 +1 800 494 3119
Holden Web LLC http://www.holdenweb.com/
wen wrote: on my system(win2k server, python 2.3.5),
import sys print sys.path
['C:\\', 'C:\\WINNT\\system32\\python23.zip', 'C:\\Python23\\lib\\site-packages\\Pythonwin', 'C:\\Python23\\lib\\site-packages\\win32', 'C:\\Python23\\lib\\site-packages\\win32\\lib', 'C:\\Python23\\lib\\site-packages', 'C:\\Python23\\DLLs', 'C:\\Python23\\lib', 'C:\\Python23\\lib\\plat-win', 'C:\\Python23\\lib\\lib-tk', 'C:\\Python23', 'D:\\Program Files\\DeLano Scientific\\PyMOL\\modules']
now, i wanna add "C:\Python23\Pmw\Pmw_1_2\lib" into sys.path, how?
any help would be appreciated.
with my kind regards, Wen
cat clpyaibot.log
* sys.path is instance of <list>.
* "C:\Python23\Pmw\Pmw_1_2\lib" is a [non-raw, living dangerously] string.
* does not compute, trying again under various failure modes ...
* detected Shift key failure
* interpreting "wanna" as "want to"
* parsed chunk: """I want to add <str> into <list>"""
* no such keyword: "add"
* <str>.add ... not found
* <list>.into ... not found
* <list>.addinto ... not found
* checking plausible alternatives ...
* <list>.append(<object>)
* <list>.insert(<index>, <object>)
Steve Holden wrote: sys.path.append(r"C:\Temp")
In this case, do I need to save the refined path, i.e, the original
paths + the new path (r"C:\Temp"), by using some command in order to use
it permanently. if yes, it would be greatly appreciated to noitce the
correspoding command and the usage of it.
-James
James Sungjin Kim wrote: Steve Holden wrote:
sys.path.append(r"C:\Temp")
In this case, do I need to save the refined path, i.e, the original paths + the new path (r"C:\Temp"), by using some command in order to use it permanently. if yes, it would be greatly appreciated to noitce the correspoding command and the usage of it.
-James
The method I outlined works only for the duration of a single program
run, because the sys.path variable is set up each time you run the
Python interpreter. You need to look at the suggestions you've had for
setting the PYTHONPATH environment variable to effect changes to all
future Python execution.
Essentially this is most usually done in the "My Computer -> Properties"
dialog: click the "environment variables" button and create a new
(all-users or private, depending on your needs) environment variable
called PYTHONPATH containing a semicolon-separated list of directories
the interpreter should add to the path.
regards
Steve
--
Steve Holden +44 150 684 7255 +1 800 494 3119
Holden Web LLC http://www.holdenweb.com/
Steve Holden wrote: The method I outlined works only for the duration of a single program run, because the sys.path variable is set up each time you run the Python interpreter. You need to look at the suggestions you've had for setting the PYTHONPATH environment variable to effect changes to all future Python execution.
Or, often better and cleaner, use .pth files as described in the
documentation for the standard library "site" module.
-Peter This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Egor Bolonev |
last post by:
hi all
i want my program to ignore ntfs links, but os.path.islink() isnt work as
i expect
print os.path.islink('''C:\Documents and Settings\åÇÏÒ\My
Documents\Scripts\Antiloop\'''')
outputs...
|
by: Steven Burn |
last post by:
Oks, I know I'm going to seem completely stupid here but, I have a question
thats been doing my head in for the last few hours.
Basically, I'm trying to find a way to turn a folder and file path,...
|
by: \A_Michigan_User\ |
last post by:
Ok, I give up.
I need to #include the same 1 file (IncludeThis.asp) into 3 different asp
files.
1> C:\MyDir\ThisFile.asp
2> D:\MyDir\AASubSub\ThatFile.asp
3>...
|
by: Reinhold Birkenfeld |
last post by:
Hi,
the arguments in the previous thread were convincing enough, so I made the
Path class inherit from str/unicode again.
It still can be found in CVS:...
|
by: Matt |
last post by:
In test() method:
var path="C:\test\hello.txt"; //returns -1 for path.lastIndexOf("\\").
why??
var pos=path.lastIndexOf("\\"); //return -1
But in showFile() method:
We are able to get the...
|
by: William Stacey [MVP] |
last post by:
I need a bullet proof way to combine a root and a relative path to form a FQ
rooted path (similar to a VDir in IIS). Path.Combine alone will not do the
job in all cases. I also need to be sure...
|
by: python |
last post by:
Bad file names, i.e. filenames the OS considers illegal, will cause
functions in the os.path module to raise an error.
Example:
import os.path
print os.path.getsize( 'c:/pytest/*.py' )
On...
|
by: Alexnb |
last post by:
Gerhard Häring wrote:
No, it didn't work, but it gave me some interesting feedback when I ran it
in the shell. Heres what it told me:
Traceback (most recent call last):
File...
|
by: moondaddy |
last post by:
I'm posting code for a user control ( FunctionConnectorSelector) below which
has 3 content controls in it. each content control uses a style from a
resource dictionary merged into the app.xaml...
|
by: bukzor |
last post by:
I have to go into these convulsions to get the directory that the
script is in whenever I need to use relative paths. I was wondering if
you guys have a better way:
from os.path import dirname,...
|
by: DolphinDB |
last post by:
Tired of spending countless mintues downsampling your data? Look no further!
In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
|
by: ryjfgjl |
last post by:
ExcelToDatabase: batch import excel into database automatically...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: ArrayDB |
last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
|
by: PapaRatzi |
last post by:
Hello,
I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
|
by: CloudSolutions |
last post by:
Introduction:
For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
|
by: Defcon1945 |
last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
|
by: Shællîpôpï 09 |
last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
|
by: af34tf |
last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
| |