1

I have a Python project which I want to run, let's say the folder is called foo. The folder contains an __init__.py. If I run it like this:

~ $ ls foo/
__init__.py
img.png
# etc...

~ $ python -m foo
# Traceback, img.png not found

How can I access img.png from the project without modifying it? I have tried python -m . in foo/ (error: Relative module names not supported) and python __init__.py in foo/ (error: No module named 'foo' because the __init__.py requires files in the project).

What should I do? The author uses an IDE to run it.

Edit: I do not want to modify the source-code, I want to know how I can run it without any modification. The author can do it, I suppose I can too.

tleb
  • 4,395
  • 3
  • 25
  • 33

0 Answers0