Hi, I’m having trouble setting up a Python project...
# getting-started
m
Hi, I’m having trouble setting up a Python project. The docs say that Pulumi supports modularized Python programs and setup.py files, but there isn’t any more info provided there and I can’t get it working with my project structure that looks like this:
Copy code
my_dir/
  Pulumi.yaml 
  setup.py // calls `setup(packages=find_packages())`
  my_package/
    __init__.py
    __main__.py // does `from .pulumi import *`
    pulumi.py // contains AWS resource created with Pulumi
Now when I run
pulumi up
in
my_dir
, I get the following error:
Copy code
ImportError: can't find '__main__' module in '.'
Which tells me that Pulumi tries to import
my_dir/__main__.py
and ignores
setup.py
. How can I fix this? Is there any documentation that I’m missing?
b
If the
__main__.py
is not in the root directory, there is a setting you can use in the Pulumi.yaml
let me just look it up
In your case, you'd want it to look something like:
main: my_dir
You'd still run pulumi up in the root folder
but you're now telling it where to start from
m
thanks @brave-planet-10645 I missed that setting
b
No problem 🙂