Have PermissionError when I run "poetry run" command
Full error message
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?Solutionsource: stackoverflow \u2197
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).
API access
Get this solution programmatically \u2014 free, no authentication.
curl https://depscope.dev/api/error/8e177ce464f3792cc6215187eee157733f23e802513b5fd7984d90278c14577ahash \u00b7 8e177ce464f3792cc6215187eee157733f23e802513b5fd7984d90278c14577a