can't import module
sugizo opened this issue · comments
sugizo commented
BUG/PROBLEM REPORT (OR OTHER COMMON ISSUE)
What I did:
server.py
from music import *
import bobo
@bobo.resource('/', method = ['GET'] )
def index():
return "index"
then execute
bobo -f server.py
What I expect to happen:
server will run well
What actually happened:
result
Traceback (most recent call last):
File "/Users/sugizo/miniconda3/envs/python3_test/bin/bobo", line 8, in <module>
sys.exit(server())
File "/Users/MacBookPro/miniconda3/envs/python3_test/lib/python3.8/site-packages/boboserver.py", line 226, in server
six.exec_(compile(open(module.__file__).read(),
File "server.py", line 1, in <module>
from music import *
ModuleNotFoundError: No module named 'music'
What version of Python and Zope/Addons I am using:
bobo == 2.4.0
Python 3.8.5
conda 4.9.2
Darwin
note
music is directory that contain python files for define and manage database
Jason Madden commented
Is the music
directory on the Python path (sys.path
)?
sugizo commented
Is the
music
directory on the Python path (sys.path
)?
$ python
Python 3.8.5 (default, Sep 4 2020, 02:22:02)
[Clang 10.0.0 ] :: Anaconda, Inc. on darwin
>>> import sys
>>> for p in sys.path:
... print(p)
...
/Users/sugizo/miniconda3/envs/python3_test/lib/python38.zip
/Users/sugizo/miniconda3/envs/python3_test/lib/python3.8
/Users/sugizo/miniconda3/envs/python3_test/lib/python3.8/lib-dynload
/Users/sugizo/miniconda3/envs/python3_test/lib/python3.8/site-packages
the music directory is not on the Python path (sys.path)
but tested with other python web framework is running well
e.g. in bottle web framework
server.py
from music import *
from bottle import run
run(host = 'localhost', port = 8000, debug = True, reloader = True)
question
how to achieve it in bobo way ?
thanks n best regards,
stifan