ScottyLabs / HackerHelp

TartanHacks 2017 mentor request and dispatch system
1 stars 0 forks source link

Python module import not working on OS X, but it is on Ubuntu #29

Closed bobbiec closed 7 years ago

bobbiec commented 7 years ago

Hacker name(s): Bobbie Chen, Vincent Kang Physical location: UC Dowd Operating system(s): OS X, Ubuntu Programming Language: Python

Description

We have a flask webapp which uses code imported from a separate module, audit_parse. On Ubuntu, it works fine. On OS X, it gives ImportError: No module named audit_parse

Directory structure:

run.py
app/
    views.py <- where I'm trying to import the audit_parse
    audit_parse/
        __init__.py
        (other stuff)

Import code (at top of views.py):

from flask import render_template, request
from app import instance
from audit_parse import parseAudit

Screenshots

<If possible, include a screenshot>

bobbiec commented 7 years ago

Related to relative imports, adding . before the import fixed the issue