[chimera-dev] Chimera's default directory
Eric Pettersen
pett at cgl.ucsf.edu
Tue Oct 31 13:22:08 PDT 2017
Hi Shuto,
When a program is started by double-clicking its icon, the current working directory is frequently arbitrary. In your case it’s “/“, i.e. the root of the Unix file system.
Getting the setting for the Locations preference is possible, but somewhat ugly. Is the purpose to find the file relative to the installation location of your plugin? If so, the simpler way to get that information is to use the “__file__” variable in your code, which is the path of the file for the currently executing code. Therefore, in your code “os.path.dirname(__file__)” is the folder where your plugin is located. Does this help?
—Eric
Eric Pettersen
UCSF Computer Graphics Lab
> On Oct 30, 2017, at 6:11 PM, Shuto Araki <shutoaraki_2020 at depauw.edu> wrote:
>
> Hi everyone,
>
> My name is Shuto Araki, a Computer Science student at DePauw University in Indiana.
> I’m currently helping a research in biochemistry department using Chimera and Python.
>
> My program reads a csv file and manipulate and visualize its data on Chimera.
> I’m trying to read a csv file, but it only works on my computer because I have to use the absolute path for the csv file.
>
> Is there a way to set the path relative? How can I set the default directory to the one that I set in the Tool Preferences —> Locations?
>
> I tried os.getcwd() to see the default directory but the IDLE only returns “/“ and I’m confused because it is supposed to return a string representing the current working directory.
> Could you please help me figure out what’s happening?
>
> Sincerely,
> Shuto
> _______________________________________________
> Chimera-dev mailing list
> Chimera-dev at cgl.ucsf.edu
> http://www.rbvi.ucsf.edu/mailman/listinfo/chimera-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://plato.cgl.ucsf.edu/pipermail/chimera-dev/attachments/20171031/b542f830/attachment.html>
More information about the Chimera-dev
mailing list