Cannot get suggestions when importing Python file from another folder (Wing IDE) -
I have a python file called caller.py which is located on C: \ Temp. I have two other Python files: located in C: \ Temp and testlib.py
in the local_testlib.py
: C: \ Temp \ MyLibs.
I am trying to import both files in Wing IDE Pro Import imported sys.path.append (r'C: \ Temp \ MyLibs') into testlib # # C: \ Temp \ MyLibs # local_testlib Import #: # Temp #check Suggestion by Wing local_testlib Get suggestions as a list of variables etc from file testlib. # No suggestions get print printlib.myvar #get variable value printed OK
I get suggestions for local_sthibit only, nothing for the testlab (see picture below). I have access to variables in testlib.py (though it is imported properly) however. What adjustments should I have to make this work?
< To resolve this, you can add C: \ Temp \ MyLibs to the wing project properties (or configure in your python path) in Wing 101 in Python. Dialog) or in Wing Personal or Pro you can set the file as the main debug file, though I have seen that you will need to restart the wing before this file is re-scanned The failed Failure to do this work approach.
This may be changed to carry local path modifications in our source analysis, although modifying sys.path in general is not a good way to work because pair Paths can screw up other modules you import later if they are trying to import a module called testlib from another location. This is why we only use this kind of modification See not the main debug file.
You can add MyLibs to your init .py file in a package instead, and then you can:
Import MyLibs from testlib
This wing resolves any additional configuration w / o in the IDE.
Comments
Post a Comment