poetry script fails to find module
Loris Bennett
loris.bennett at fu-berlin.de
Fri Jul 29 04:46:43 EDT 2022
Hi Stefan,
ram at zedat.fu-berlin.de (Stefan Ram) writes:
> "Loris Bennett" <loris.bennett at fu-berlin.de> writes:
>>Why is the module 'hpc' not found by the poetry script?
>
> I have tried to execute the following sequence of shell
> commands to understand your problem. Here they all worked
> without error messages. Warning: Some of these commands might
> alter your directories or data, so only execute them if you
> are aware of their meaning/consequences and agree with them!
I do know what the commands do. However, just to be on the safe side,
but mainly in honour of a classic dad-joke, I changed 'stoat' to
'weasel'.
> mkdir stoat
> mkdir stoat/hpc
> echo import hpc.main >stoat/main.py
> echo >stoat/hpc/main.py
> python3 stoat/main.py
> cd stoat
> python3 main.py
I guess with the production version, the package
stoat
is visible in sys.path and thus the subpackages have to be referred to
via the main package, e.g.
import stoat.hpc.main
However, in the development environment, if I run
python stoat/main.py hpc user --help
then is
stoat/hpc/main.py
being found via
import hpc.main
because Python looks in
stoat
as the parent directory of
stoat/main.py
rather than the current working directory? That doesn't seem likely to
me, but I am already confused.
Cheers,
Loris
--
This signature is currently under construction.
More information about the Python-list
mailing list