Hello, I am running into a "ModuleNotFoundError" i...
# python
l
Hello, I am running into a "ModuleNotFoundError" issue strictly when customizing the main setting (entrypoint) of the Pulumi.yaml file. The code works fine when I let it use the default ___main___.py file, but if I change it to a custom file, it throws the error and no combination of __init___.py files makes any difference. Any ideas or thoughts?
e
Is this from setting "main" in the Pulumi.yaml? The filename from that value is what's passed as an arg to "python3", if it doesn't point to a file then we run "python3 .". That difference of "." or a file does change pythons module loader a bit though iirc. There's an issue about this with some thoughts on direction to fix this at https://github.com/pulumi/pulumi/issues/7360
l
Yes, all I'm really trying to do is to use a different name than _ main_.py (say infra.py) for my entrypoint file by setting "main: infra.py" in the Pulumi.yaml file, with both those files at the root of the project and then some nested components. What's weird is that it "works" if I do something like "python3 infra.py", meaning that python is able to resolve the modules for the nested components that are being imported inside infra.py. That makes me think that this is not a python issue per se, since python is able to load infra.py and it's imports correctly when used directly, but it sounds like somehow things change when pulumi is the one calling python. And thanks for the link to the issue. The original repro in that issue is much more complicated than what I'm looking for, but it sounds like there could be some root problem, so I'll add a comment with my own repro and see if get's some traction.