WolframResearch / WolframClientForPython

Call Wolfram Language functions from Python
https://wolfr.am/wolframclientdoc
MIT License
446 stars 47 forks source link

Fix import error of extension module "roles" #5

Closed wdscxsj closed 5 years ago

DbxDev commented 5 years ago

I'm not understanding this fix. Can you maybe provide a bit more context?

wdscxsj commented 5 years ago

Sure. To build the doc using Sphinx, conf.py specifies a custom extension roles, which is included in the docs directory. But the original line sys.path.insert(0, os.path.abspath('roles')) won't allow access to the roles module. That's why I changed the path to the docs directory, supposing sphinx-build is executed there.

With the proposed change, I managed to build the documentation on Windows with Python 3.7.3.

DbxDev commented 5 years ago

I don't understand the fix. When starting the interpreter the directory containing the script is inserted to the sys.path array. See documentation.

As initialized upon program startup, the first item of this list, path[0], is the directory containing the script that was used to invoke the Python interpreter.

I have no issue regarding roles, can you maybe put the error message. Thanks.

wdscxsj commented 5 years ago

Sure. This is what happens when I run sphinx-build under the docs directory:


WolframClientForPython-master/docs$ sphinx-build -b html . _build
Running Sphinx v2.2.0

Extension error:
Could not import extension roles (exception: No module named 'roles')
DbxDev commented 5 years ago

I can't reproduce. I prefer using $ python3 -msphinx in place of sphinx-build, so that I know what python runtime is used. I wrote a script to automate the build process docs/build_docs.sh. You may want to try it instead.