python- dulwich only working in interpreter, but not as a script

183 views Asked by At

I am trying to use dulwich to access my git repositories. I have followed the documentation and installed it as required, and then tried running this simple script:

>>> from dulwich.repo import Repo
>>> r = Repo(<path/to/my/repo>)
>>> r.head()
>>> c = r[r.head()]
>>> c
>>> c.message

When I type that line by line in the Python interpreter, it works fine, and I get the intended results.

However, when I create a script with the same commands, and then try running it from terminal using python script-name.py, I get no results at all.

And finally, when I run the same script in PyCharm, I get an error that says ModuleNotFoundError: No module named 'dulwich.repo'; 'dulwich' is not a package.

Any idea what is happening here, because I can't find anything helpful?

0

There are 0 answers