module not loading in .py file using netgen in terminal

More
2 years 5 months ago #4437 by swanket
HI,
I am new to ngsolve and I recently received a model from a colleague that uses ngsolve. After installing using pip a demo of the model should be usable by simply saying "netgen demo.py" in terminal. demo.py is a python file with the code to run the model and calls a module within it. That module is in the same folder as demo.py and appears usable in vscode when I am reading the code, however when I run this line in terminal I get the error: "ModuleNotFoundError: No module named 'magmaxisym'". If I run the code in vscode this is not an issue, however I don't have access to the actual geometry so I need to be using ngsolve. 
Do you have any suggestions on how to fix this issue? I am using the pip install on a Mac.

Thanks
More
2 years 5 months ago #4440 by christopher
Hi, did you also get an additional file "magmaxisym.py" from your colleague? You need to add the folder of that file to your PYTHONPATH environment variable. you can also run the code in visual studio and add
Code:
import netgen.gui
at the top of the file to open the gui from python.
More
2 years 5 months ago #4443 by swanket
So magmaxiym is a subfolder in the same folder as demo.py. In the magmaxiysm subfolder there is a _init_.py file which as I understand it tells python to treat magmaxiysm as a module. So I believe they are already on the same path but I still have this issue.
More
2 years 5 months ago #4445 by christopher
You need to add "." to your PYTHONPATH environment variable then.
Time to create page: 0.107 seconds