igraph-help
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [igraph] write to file problem


From: Tamas Nepusz
Subject: Re: [igraph] write to file problem
Date: Thu, 20 Jan 2011 16:23:04 +0100
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.13) Gecko/20101208 Lightning/1.0b2 Thunderbird/3.1.7

In "ordinary" Python, the current directory is the one where you are in
the shell when you start up the script. I don't know how it works with
Enthought Python. A quick way to force the current directory the same
where the script is is as follows:

import os, sys

os.chdir(os.path.dirname(sys.modules[__name__].__file__))

-- 
T.

On 01/20/2011 04:19 PM, Simone Gabbriellini wrote:
> I see... it's writing file to:
>
> /Library/Frameworks/Python.framework/Versions/6.2/Resources
>
> is there a way to set the current directory to be in the same folder
> of the script?
>
> 2011/1/20 Tamas Nepusz <address@hidden>:
>> YOu don't have to specify an absolute path, but if you don't add one,
>> igraph will save it in the current folder. Use os.getcwd() to figure out
>> the current working directory.
>>
>> --
>> T.
>>
>> On 01/20/2011 04:03 PM, Simone Gabbriellini wrote:
>>> yes, it was the absolute path I was missing!
>>>
>>> 2011/1/20 Tamas Nepusz <address@hidden>:
>>>>> I am on Mac OSX 10.6.6... But I am working with the enthought python
>>>>> distribution, so I have moved the igraph from its original location,
>>>>> maybe this can break something?
>>>> This shouldn't break anything, but are you sure you are looking for the
>>>> file in the right directory? Try specifying an absolute path (e.g.,
>>>> "/tmp/test.graphml") and look for the file in /tmp.
>>>>
>>>> --
>>>> T.
>>>>
>>>>
>>>> _______________________________________________
>>>> igraph-help mailing list
>>>> address@hidden
>>>> http://lists.nongnu.org/mailman/listinfo/igraph-help
>>>>
>>> _______________________________________________
>>> igraph-help mailing list
>>> address@hidden
>>> http://lists.nongnu.org/mailman/listinfo/igraph-help
>>>
>> _______________________________________________
>> igraph-help mailing list
>> address@hidden
>> http://lists.nongnu.org/mailman/listinfo/igraph-help
>>
> _______________________________________________
> igraph-help mailing list
> address@hidden
> http://lists.nongnu.org/mailman/listinfo/igraph-help
>



reply via email to

[Prev in Thread] Current Thread [Next in Thread]