SunQuest
           Python Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming LanguagesPython Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Be the architects of evolution and help create the mobile internet future. It’s your move---enter to win here!
  #1  
Old February 12th, 2003, 04:24 PM
calorics calorics is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2003
Posts: 12 calorics User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Question open() path

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.

Reply With Quote
  #2  
Old February 12th, 2003, 05:30 PM
Strike Strike is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2001
Location: Houston, TX
Posts: 383 Strike User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 41 m 27 sec
Reputation Power: 7
Send a message via ICQ to Strike Send a message via AIM to Strike Send a message via Yahoo to Strike
Re: open() path

Quote:
Originally posted by calorics
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
Tytan

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()
__________________
Debian - because life's too short for worrying.
Best. (Python.) IRC bot. ever.

Reply With Quote
  #3  
Old February 13th, 2003, 05:58 AM
telex4's Avatar
telex4 telex4 is offline
Wacky hack
Dev Shed Novice (500 - 999 posts)
 
Join Date: Apr 2001
Location: London, England
Posts: 512 telex4 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 25 m 29 sec
Reputation Power: 8
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.

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesPython Programming > open() path


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway