attentionbydesign / tymera

Custom Scripts
GNU General Public License v3.0
0 stars 0 forks source link

ref path for r2d #5

Closed attentionbydesign closed 2 months ago

attentionbydesign commented 2 months ago

using ../ref/color_key.txt for example works fine when opening the colorbyseq.py script and running from the IDLE in chimera, but unable to locate when running as a function of the parent module. E.g., tymera.ColorBySeq.colorbyseq() returns error that ../ref/color_key.txt is not found. Perhaps imported modules aren't run from the directory they exist in? In which case, could maybe add in a os.chdir or find out a way to automatically use whatever sys.path item leads to tymera/, then define all paths starting from there?

attentionbydesign commented 2 months ago

able to use os.path.dirname(file) to get the path that contains the current script, but would be nice to be able to define the tymera_path/ one time globally, and have it work for each package, module, function, etc.

attentionbydesign commented 2 months ago

created commonfunctions.py in tymera/ which defines r2d

from tymera.commonfunctions import r2d

seems to work from any script now