-
Notifications
You must be signed in to change notification settings - Fork 12
Add automatically path for i-PI from all scripts in bin #106
Comments
@ondrej and @thomas have done that path juggling modification so I am not On 29 January 2016 at 16:57, Mariana Rossi notifications@github.com wrote:
|
👍 |
To be honest, I am not a fan of that path injection even in the main program - it should simply never be needed. You source the That being said, if you insist, I will not try and stop you :-) I would be interested in what the use case for this is, though. |
BTW, Github technical tip - you can quote a code block without having the formatting messed up using triple backticks. If you add the name of language, you even get syntax highlighting! https://help.github.com/articles/creating-and-highlighting-code-blocks/ # Check that we have the import path for this i-PI set and if not, add it.
dir_root = os.path.realpath(
os.path.join(os.path.dirname(os.path.realpath(__file__)), '..'))
if not dir_root in sys.path:
sys.path.insert(0, dir_root) |
Hi Ondrej -- I know, I can certainly set my paths, source env.sh, etc. However, I've gotten reports back from quite a few people complaining they can't run this or that routine. The reason being that since the main code has those lines in, I think people just use it and don't notice. Then when they use another one of the routines in bin, they get stuck because they never set the paths. So, I was just thinking about minimizing complaints with something that should ideally work out of the box for a more pleasant experience. If you want to take it out of the main code, by all means go forward. I'd say better all or nothing. |
OK, I see what you mean. This is relevant also to the situation after release, of course. For some reason, I was certain that the instruction to source My preference would be to document |
Note that as the executables are simple Python programs, they can be simply copied elsewhere (say, when modifying them), but will "magically" stop working if the |
I suggest to add the following lines:
dir_root = os.path.realpath(
os.path.join(os.path.dirname(os.path.realpath(file)), '..'))
if not dir_root in sys.path:
sys.path.insert(0, dir_root)
to all scripts in the bin folder, not only the main i-PI -- so that all executions happen seamlessly. Agreed? If so I will proceed to do it.
The text was updated successfully, but these errors were encountered: