5

I execute the below command, in the same working directory as file worker.py:

poetry run worker.py

Terminal:

me@LAPTOP-G1DAPU88:~/.ssh/workers-python/workers/composite_key/compositekey$ poetry run worker.py 

  FileNotFoundError

  [Errno 2] No such file or directory: b'/snap/bin/worker.py'

  at /usr/lib/python3.8/os.py:601 in _execvpe
       597│         path_list = map(fsencode, path_list)
       598│     for dir in path_list:
       599│         fullname = path.join(dir, file)
       600│         try:
    →  601│             exec_func(fullname, *argrest)
       602│         except (FileNotFoundError, NotADirectoryError) as e:
       603│             last_exc = e
       604│         except OSError as e:
       605│             last_exc = e
me@LAPTOP-G1DAPU88:~/.ssh/workers-python/workers/composite_key/compositekey$ ls
 Citizenship.csv                   __pycache__                 dagster.yaml   pytest.ini                  simulate_alien_dict.py   tasks.py
"Gordian Algorithms' Times.xlsx"   config.yaml                 data           run_pipeline.yaml           simulate_data.ipynb      tests
 __init__.py                       currency_symbols_map.json   modules        simulate_alien_dict.ipynb   simulate_data.py         worker.py

Clearly, we see the file is there (bottom-right).


Questions

  • Why is this an issue caused?
  • How would you resolve this issue, in future?

Please let me know if there's anything else I should add to post

2 Answers 2

6

poetry run means "run the following command in the venv managed by poetry".

So the correct way of using it in your case is: poetry run python worker.py

1
  • I seem to have a Traceback Error, but that's a separate issue. Ty Oct 21, 2021 at 10:15
1

Check the file pyproject.toml, most likely the path or the name of the worker.py file itself was incorrectly specified there!

1
  • Will keep in mind this check in the future. Usually pyproject.toml has some sort of involvement in errors. Nov 18, 2021 at 12:12

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.