johnf wrote:
> On Thursday 05 February 2009 07:06:17 pm Bob Sysero llc Dev wrote:
>   
>> Ed Leafe wrote:
>>     
>>> On Feb 5, 2009, at 5:23 PM, Bob Sysero llc Dev wrote:
>>>       
>>>> The error message if I am right in the command line is telling me that
>>>> python has no scope about $HOME and that is why I am getting the
>>>> error.
>>>>         
>>>     That's an bash variable, not a Python value.
>>>
>>>     You can access your home directory with the following:
>>>
>>> import os
>>> print os.path.expanduser("~/temp/l.txt")
>>>
>>>
>>> -- Ed Leaf
>>>       
>> I just tried it in the command line and I like it "os.path.expanduser()".
>>
>> Thank you
>> Bob
>>     
> What's the parameter you are passing?  
>   
All I did was print os.path.expanduser("~/temp/l.txt")

 >>> print os.path.expanduser("~/temp/l.txt")
/home/bobsysero/temp/l.txt
 >>>
 >>> print os.path.expanduser("~/")
/home/bobsysero/
 >>>

The print os.path.expanduser("~/") is a simple way to get the home path. 
I need to check the Python documentation on more details.

Bob







_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-users
Searchable Archives: http://leafe.com/archives/search/dabo-users
This message: http://leafe.com/archives/byMID/[email protected]

Reply via email to