<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Hi Shuto,<div class=""><span class="Apple-tab-span" style="white-space:pre"> </span>When a program is started by double-clicking its icon, the current working directory is frequently arbitrary. In your case it’s “/“, <i class="">i.e.</i> the root of the Unix file system.</div><div class=""><br class=""></div><div class=""><span class="Apple-tab-span" style="white-space:pre"> </span>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?</div><div class=""><br class=""></div><div class="">—Eric</div><div class=""><br class=""><div class=""><br class=""><div class="">
<div style="color: rgb(0, 0, 0); letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class=""><span class="Apple-tab-span" style="white-space: pre;"> </span>Eric Pettersen</div><div class=""><span class="Apple-tab-span" style="white-space: pre;"> </span>UCSF Computer Graphics Lab</div><div class=""><br class=""></div></div>
</div>
<br class=""><div><blockquote type="cite" class=""><div class="">On Oct 30, 2017, at 6:11 PM, Shuto Araki <<a href="mailto:shutoaraki_2020@depauw.edu" class="">shutoaraki_2020@depauw.edu</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div class="">Hi everyone, <br class=""><br class="">My name is Shuto Araki, a Computer Science student at DePauw University in Indiana.<br class="">I’m currently helping a research in biochemistry department using Chimera and Python.<br class=""><br class="">My program reads a csv file and manipulate and visualize its data on Chimera.<br class="">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.<br class=""><br class="">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?<br class=""><br class="">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.<br class="">Could you please help me figure out what’s happening?<br class=""><br class="">Sincerely, <br class="">Shuto<br class="">_______________________________________________<br class="">Chimera-dev mailing list<br class=""><a href="mailto:Chimera-dev@cgl.ucsf.edu" class="">Chimera-dev@cgl.ucsf.edu</a><br class="">http://plato.cgl.ucsf.edu/mailman/listinfo/chimera-dev<br class=""><br class=""></div></div></blockquote></div><br class=""></div></div></body></html>