-
Notifications
You must be signed in to change notification settings - Fork 189
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Problem importing python file from current directory #502
Comments
I get the same error. unshift!(PyVector(pyimport("sys")["path"]),"") does not work. |
What is your current directory? i.e. what is |
Sorry, I found that my problem is caused by a python module named gurobipy. The problem is solved after reinstalling the module. |
Adding an empty string to $ cat script.jl
using PyCall
pushfirst!(PyVector(pyimport("sys")["path"]), @__DIR__)
pyimport("mymodule")[:main]()
$ cat mymodule.py
def main():
import sys
print(*sys.path, sep="\n")
if __name__ == "__main__":
main()
$ cd /
$ julia /PATH/TO/DIR/script.jl
/PATH/TO/DIR
/usr/lib/python37.zip
/usr/lib/python3.7
/usr/lib/python3.7/lib-dynload
/usr/lib/python3.7/site-packages
$ python /PATH/TO/DIR/mymodule.py # prints the same paths Of course, (We probably should add this to README) |
In the README I think instead of suggesting the command |
I have tried the solution suggested on #48 , but it is not working. I am using Julia 0.6.2 on Windows with Python 2.7 and the program is
and I get the error message
The text was updated successfully, but these errors were encountered: