简体   繁体   中英

Python: Import Module with Wing IDE

I am new to Python and I have trouble to import modules with Wing IDE/Python 2.7/Mac OS

I have read: Import module from other directory in Wing Ide

and: http://docs.python.org/2/tutorial/modules.html

but still I don't get it.

If, as presented in the second link, I create a fibo.py script and save it in my Python Path then when I try to import it, I have the following error:

import fibo
Traceback (most recent call last):
File "<string>", line 1, in <fragment>
ImportError: No module named fibo

although fibo is available for auto-completion when I type

import 

What did I miss? Thanks for your answers

That error indicates that the module is not found on the path, so either it's in the wrong place or the path is not what you think it is. You can look at sys.path (after 'import sys') to see the path.

I'm not certain why Wing is offering auto-completion there. One possibility is that you've modified your Python Path in Project Properties (or Configure Python dialog in Wing 101) and have not yet restarted the Python Shell from its Options menu.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM