February 12th, 2003, 04:24 PM
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
Last edited by calorics; September 17th, 2003 at 06:45 PM.
February 12th, 2003, 05:30 PM
Re: open() path
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()
February 13th, 2003, 05:58 AM
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.