Skip to content Skip to sidebar Skip to footer

Python Sys.path - Appending Pythonpath

Before start I have been trying to accomplish it for some time now, but I had no luck. I'm trying to create my own python package, which I will import the modules in it, in separat

Solution 1:

If you do not have the file __init__.py in your core folder, it will not be recognized as a package.

Therefore the solution is to add a file __init__.py in your core folder.

If you have already added the problem may be the absolute path ... the core folder that has absolute path:

  1. /var/www/core
  2. /var/www/YourProject/core

if the second option you have to do: sys.path.append('/var/www/YourProject')

Solution 2:

You need to explicitly set PYTHONPATH with you root directory.

Post a Comment for "Python Sys.path - Appending Pythonpath"