Ask Your Question
1

Accessing resources from another project

asked 2014-02-03 05:46:15 -0500

phn gravatar image

updated 2015-01-14 09:19:59 -0500

FrédéricC gravatar image

I'm thinking of organizing my code as follows:

  • Project A (private) has all the libraries and common python modules.
  • Projects B, C, D (public) have mostly notebooks that make use of python modules in (A)

I added the absolute path to project A modules in a local.pth file of project B:

~/.local/lib/python2.7/site-packages/local.pth

Also did chmod 755 (read and execute by everyone) on all resources in project A. Testing with python in a console (project B) shows that the path to project A is not added to sys.path. The same works fine when I'm in project A. Any idea how to proceed?

edit retag flag offensive close merge delete

2 answers

Sort by » oldest newest most voted
0

answered 2014-02-06 12:12:55 -0500

phn gravatar image

I confirm that the method above does work when the path listed in local.pth is in the same project as the one where python is executed.

What does not work for me is to add a path to a project "B" folder when I'm running python from project "A". I checked and double-checked the spelling in local.pth.

edit flag offensive delete link more
0

answered 2014-02-04 21:48:42 -0500

Jeroen Demeyer gravatar image

updated 2014-02-04 21:49:33 -0500

It works for me.

Adding a directory to ~/.local/lib/python2.7/site-packages/local.pth and starting up Sage shows that the directory in local.pth is indeed added to sys.path. Are you sure your paths are correct?

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 2014-02-03 05:46:15 -0500

Seen: 64 times

Last updated: Feb 06 '14