|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Be the architects of evolution and help create the mobile internet future. It’s your move---enter to win here! |
|
#1
|
|||
|
|||
|
Hi, i know it isnt possable to redefine the built-in open function, is there a way to tell it where to look so u dont have to enter the whole path? ie.
I have a script in c:\python_scripts and i want to access files in the apache htdocs directory (c:\apache\htdocs\). Thanks in advance Tom Last edited by calorics : September 17th, 2003 at 06:45 PM. |
|
#2
|
|||
|
|||
|
Re: open() path
Quote:
I think it's sys.path.append("/some/path/here"), but I'm not sure that's the path that it uses (I know that it uses that for python modules, ie, the PYTHONPATH). But also, in 2.2 and later it's file() and not open() ![]() |
|
#3
|
||||
|
||||
|
You could always just make your own function to fake it for you, by taking the path (image.jpg) and appending it to your prefix (/wherver/you/want) so you can just call myopen("image.jpg") and it will do it for you.
|
![]() |
| Viewing: Dev Shed Forums > Programming Languages > Python Programming > open() path |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|