Forum Message

 

 

We have moved the forum to https://forum.ngsolve.org . This is an archived version of the topics until 05/05/23. All the topics were moved to the new forum and conversations can be continued there. This forum is just kept as legacy to not invalidate old links. If you want to continue a conversation just look for the topic in the new forum.

Notice

The forum is in read only mode.

How to call a script file? ModuleNotFoundError: No module...

More
6 years 5 months ago - 6 years 5 months ago #268 by Karatza
Hi,
i am trying to call after executing the python file

File Attachment:

File Name: fibo-main.py
File Size:0 KB

the file

File Attachment:

File Name: fibo.py
File Size:0 KB


In python3 works ($ python3 fibo-main.py
1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 987
), is there any way to do something similar using ngsolve?
I see the error:

$ netgen fibo-main.py
...
importing NGSolve-6.2.1709-77-gef89d2d0
(should) load python file 'fibo-mai.py'
Traceback (most recent call last):
File "<string>", line 1, in <module>
ModuleNotFoundError: No module named 'fibo'
Finished executing fibo-main.py


best wishes
Makis
Last edit: 6 years 5 months ago by Karatza.
More
6 years 5 months ago #269 by cwinters
Hi,

you have to add the working directory (".") to the PYTHONPATH.
Using bash, this can be done as follows
Code:
export PYTHONPATH=$PYTHONPATH:.

Best,
Christoph
The following user(s) said Thank You: Karatza
Time to create page: 0.161 seconds