[Pythonmac-SIG] Re: Path Issues
Bob Ippolito
bob at redivi.com
Mon Nov 3 15:51:34 EST 2003
On Nov 3, 2003, at 3:44 PM, Joshua Tompkins wrote:
> Bob Ippolito wrote:
>
>>
>> On Nov 3, 2003, at 3:28 PM, Joshua Tompkins wrote:
>>
>>> Yes, I'm using the open() builtin function.
>>
>>
>> Are you using it from an application bundle? an app opened via
>> LaunchServices (Finder, the open command) will have a getcwd() of /
>> when it starts. Try "print os.getcwd()" to see where the cwd is.
>>
>> -bob
>>
>>
> I'm running Python by typing "python" from the Terminal.
>
> os.getcwd() returns "/Users/joshua" (with that capitalization).
What is the line of code that you're trying?
open("~/source/python/file") does not work
you need to do
open(os.path.expanduser("~/source/python/file"))
if you want to use tilde expansion.
-bob
More information about the Pythonmac-SIG
mailing list