2

I'm fairly new to Python (mostly a Java / C developer) and am having a bit of import problems. I've read on many other posts here that to declare a package one must add __init__.py to the respective folder.

So here is what my structure looks like:

app/ src/ __init__.py resumeParser.py tests/ test_resumeParser.py

So inside test_resumeParser.py I have the following line:

from src.resumeParser import *

and this is the line cauing me an ImportError: no module named 'src'

I'd appreciate any way to get around this issue. Thanks!

Muhammad Khan
  • 425
  • 1
  • 4
  • 14

1 Answers1

1

Add the app directory path to the PYTHONPATH when run the test so that src can be imported:

PYTHONPATH=/path/to/app python ....
falsetru
  • 357,413
  • 63
  • 732
  • 636