admin管理员组

文章数量:1395014

I am hosting python script via:

bokeh serve example.py

and example.py loads local package 'local_module' located in the parent directory. When opening associated local host html (http://localhost:5006/example), the error pops up saying "ModuleNotFoundError: No module named 'local_module'".

If placing the 'example.py' file in the the parent directory (where the package 'local_module' is located) then "bokeh serve" runs successfully and package is located when launching the html.

Is there a way to configure Bokeh path variables that it would look into the local parent directory for the package (similarly like setting Python environment to look for local packages)?

Upon looking through possible Bokeh Settings (.html), it did not seem that any of the setting fields can be used to define the path that would be used to locate python packages.

I am using PyCharm project which automatically extends sys.path to include project scope (in the venv of the project), thus 'example.py' runs normally and locates the package.

I am running bokeh serve example.py from the PyCharm terminal window that has project's venv loaded.

本文标签: pathPython bokeh serve does not recognize local package located in the parent directoryStack Overflow