Environment

  • Ubuntu 20.04
  • Python 3.7.3
  • Poetry 1.0.8

My Problem

I installed poetry to manage packages, and I tried it with following simple project,

. └── myproject ├── README.rst ├── myproject │   ├── __init__.py │   ├── main.py ├── myproject.egg-info │   ├── PKG-INFO │   ├── SOURCES.txt │   ├── dependency_links.txt │   ├── requires.txt │   └── top_level.txt ├── poetry.lock ├── pyproject.toml └── tests ├── __init__.py └── test_myproject.py 

To run main.py I tried

$ poetry run myproject/main.py 

But I had an error, which says,

[PermissionError] [Errno 13] Permission denied 

What I tried

To run my code, I tried another way.

$ poetry shell (myproject-x8XipcUE-py3.7)$ python myproject/main.py 

I had no error...

What is the problem for my poetry run command?

2 Answers

Just for reference you can also do poetry run python myproject/main.py.

1

My guess is that myproject/main.py isn't an executable (doesn't have the 'x') permission. That's why you can run it with python myproject/main.py, but can't run it as the main exe. To fix it, run chmod +x myproject/main.py, and then try poetry run again.

Of course, you'll have to have a proper Shebang at the very top of main.py. Something like #!/usr/bin/env python (again - at the very beginning of the file).

1

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy