Skip to content
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

Importing logic is different from python #5291

Open
anki-code opened this issue Mar 1, 2024 · 1 comment
Open

Importing logic is different from python #5291

anki-code opened this issue Mar 1, 2024 · 1 comment
Labels

Comments

@anki-code
Copy link
Member

anki-code commented Mar 1, 2024

mkdir -p /tmp/123
cd /tmp/123
mkdir -p pkg

echo "print('hello')" > pkg/importme.py
echo "import pkg.importme" > run.py

python run.py
# hello

xonsh run.py
# ModuleNotFoundError: No module named 'pkg'

Do we need to do the same as in python?

For community

⬇️ Please click the 👍 reaction instead of leaving a +1 or 👍 comment

@anki-code
Copy link
Member Author

To fix this you need add current path in the beginning:

import sys
sys.path.append('.')

import pkg.importme

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

No branches or pull requests

1 participant