|
#1
|
|||
|
|||
Thanks! So, after your comment I confirmed that it works if the module is in the current directory of the script I'm working on. Very cool!
But, as you suspected, I have it setup as a package in a different directory (including __init__.py). I have added the path to the enclosing folder with sys.path.insert, but it still doesn't work.. ? |
#2
|
|||
|
|||
Can you post the code you are using to import the file including any path related commands?
|
#3
|
|||
|
|||
Sure!
Directory structure is set up like this: Code:
FIVEL/ top-level enclosing folder fvl/ package __init__.py package initalization likertScaleObj.py example package module(s) VRproject/ project directory F18/ F18.py last semester's version of the exp S19/ S19.py current semester's version Code:
import sys import os import os.path as path sys.path.insert(0, path.dirname(path.dirname(path.dirname(__file__)))) #confirm path info with print statements print path.dirname(__file__) print path.dirname(path.dirname(__file__)) print path.dirname(path.dirname(path.dirname(__file__))) print sys.path print os.listdir(path.dirname(path.dirname(path.dirname(__file__)))) import fvl #no error thanks! |
#4
|
|||
|
|||
It does not look like the autocomplete is set to work with paths added on the fly using the sys.path.insert command. It may work by adding to the PYTHONPATH environment variable.
If the module is in a directory above you could use the following code to import the module. I just tested and this worked for me with the autocomplete: Code:
# import module in directory above from .. import my_module # import module two directories above from ... import my_module |
#5
|
|||
|
|||
The workaround worked for me too. Thanks for checking on that!
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
view_coliision module | bbb | Vizard | 2 | 08-24-2016 12:46 AM |
Could not locate _Vizcore module | Bhavesh | Vizard | 1 | 06-21-2016 01:48 AM |
vizinput module missing | whaleeee | Vizard | 1 | 02-05-2013 11:30 PM |
Exception in module vizjoy | fordprefect | Vizard | 2 | 12-03-2012 01:41 AM |
vhil module | vadrian | Vizard | 2 | 01-27-2005 11:52 AM |