-
-
Notifications
You must be signed in to change notification settings - Fork 105
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
ModuleNotFoundError when executing source code locally, if "git_sim." prefix isn't removed #18
Comments
Did you try installing with https://pypa.github.io/pipx instead of |
@initialcommit-io yeah I think the whole imports / packages / modules stuff is one of the more confusing parts of python, I find myself trying to make sense of it very often 😅 I tried running the file directly and see the same behavior you described. I think I found the issue in our case though: We have a file git_sim
├── git_sim_add.py
├── git_sim_base_command.py
├── git_sim_branch.py
├── git_sim_cherrypick.py
├── git_sim_commit.py
├── git_sim_log.py
├── git_sim_merge.py
├── git_sim.py <-- here
├── git_sim_rebase.py
├── git_sim_reset.py
├── git_sim_restore.py
├── git_sim_revert.py
├── git_sim_stash.py
├── git_sim_status.py
├── git_sim_tag.py
├── __init__.py
├── logo.png
└── __main__.py So what I think happens, is that python gets confused that there is a module and a package with the same name. For me it seems to work in either case after moving the contents of |
We could of course also just rename the file |
I do prefer to keep Hmm, so I renamed But when I run
Does this work for you? |
Yeah, that works for me 🤔 |
Hi guys,
This will install all the necessary dependencies listed in the package and install in developer mode. Meaning, it will always use the source to serve the commands. You can edit the source and it will be reflected immediately. I have opened a PR to update the |
This was fixed with the help of @abhijitnathwani and @cclauss. See linked PR for details. Thank you both! |
@paketb0te I think maybe you can help me with this since I haven't had too much time to research it.
Basically, for local testing of Git-Sim I like to directly run the
__main__.py
file with python like this:But the problem is since it's not running as a package I end up getting errors like:
ModuleNotFoundError: No module named 'git_sim.git_sim_add'; 'git_sim' is not a package
I can get around this by removing the package prefix
git_sim.
in all the imports, but its very annoying because I need to remember to stash those changes before building the code for release, and I need to make sure not to commit that by accident.Do you have any thoughts on how I can test locally without having to mess with the imports like that?
The text was updated successfully, but these errors were encountered: