Skip to content

Unable to precompile when importing a locally defined module #281

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

Closed
josephsdavid opened this issue Mar 9, 2023 · 2 comments
Closed

Unable to precompile when importing a locally defined module #281

josephsdavid opened this issue Mar 9, 2023 · 2 comments

Comments

@josephsdavid
Copy link

josephsdavid commented Mar 9, 2023

Hello! I am having a very hard time importing a local module. I have tried how it is demoed in #70, but i am having little to no luck. I have made a demo with a small MRE for what i am trying to do here. Is there something i am doing wrong? Or what is the Blessed way to import a local module these days?

(Note, it works just fine when I am running it line by line, but when I "using" the Julia module nothing seems to work)

@cjdoris
Copy link
Collaborator

cjdoris commented Mar 10, 2023

It would be useful in the future if you include the error you are seeing too.

I assume you're getting

ERROR: InitError: Python: ModuleNotFoundError: No module named 'foo'

which occurs because the line https://github.com/josephsdavid/pythoncallmre.jl/blob/main/src/pythoncallmre.jl#L8 should be

pth = (@__DIR__) * "/../py"

because @__DIR__ is the src directory.

Aside, it's better to do

pth = joinpath(dirname(@__DIR__), "py")

which is platform-independent.

@cjdoris cjdoris closed this as completed Mar 10, 2023
@josephsdavid
Copy link
Author

🤦 ah whoops, thank you so much for your help on this :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants