https://pantsbuild.org/ logo
#general
Title
# general
c

curved-television-6568

09/06/2021, 9:29 AM
Not sure what gives, but if I have a
pex_binary(entry_point="main.py")
but no
python_library()
I get this error when running the pex:
Copy code
ImportError: Error while finding module specification for 'helloworld.main' (ModuleNotFoundError: No module named 'helloworld')
Adding the python_library target solves it, but that may not be the most obvious thing, given the error message..
What I’m after really is, if it would be possible to catch this error when building the pex, as clearly it can’t run, so the result will be broken.
h

happy-kitchen-89482

09/06/2021, 10:04 AM
Hmm interesting one
Not sure if we can catch the error while building the pex
In general we can't catch missing dependencies and things like that
We could maybe hypothetically catch this one because the missing dependency is directly referenced by the
pex_binary
as its entry point
But even then not in all cases
we might misdetect - for example the entry point might be installed by a 3rd party requirement in some way we can't know about
👍 1
So that might be tricker than it looks at first
c

curved-television-6568

09/06/2021, 4:01 PM
Ah, right. 👍🏽
4 Views