Lp3thw ex52 import errors

I’m having some trouble in ex.52 with some import errors.
First my directory structure:

My import commands in tests and files are these:


from nose.tools import *
from gothonweb.planisphere import *


from nose.tools import *
from gothonweb.app import *


from flask import Flask, session, redirect, url_for, escape, request
from flask import render_template
from gothonweb import planisphere

Now, with imports like these i can run tests perfectly with:
nosetests app_tests.py
nosetests planisphere_tests.py

from the /tests directory. The problem is i can’t run the app.py file. When I go cd … and then ‘python app.py’ i get import error:

file 'app.py'
from gothonweb import planisphere

I can change the import commands for this to work but then my tests will have an import error. I tried ‘$env:PYTHONPATH = “$env:PYTHONPATH;.”’ but still not working.

I haven’t been able to fix this.
Where is my mistake?

Thank you.

In your screenshot it looks like you have an __init__.py file in the root (top) of the project. Delete that. Then delete the __pycache__ directory too just to be sure. Try that. Also, maybe it’s time to switch to PyTest instead: