unable to import modules from other folders

M

moijes12

Hi friends

I have a module "bigbee" in folder C:\MyDocs\BigBee and another module
"foo" needs to import from this.however, "foo" is in D:\foo.

foo.py :

from bigbee import *

The error i get is:

ImportError: No Module bigbee.

Please provide a solution.
 
M

morton.thomas

C:\MyDocs needs to be in the sys.path variable for python to include
it in it's search for modules

Try this:

import sys
sys.path.append('C:\MyDocs')

If you are packaging your program for reuse or later move that folder
bear in mind it will *break*

A better method would be to place the module into site-packages OR in
the same directory as the Py script that uses it.

:)

Tom

Hi friends

I have a module "bigbee" in folder C:\MyDocs\BigBee and another module
"foo" needs to import from this.however, "foo" is in D:\foo.

foo.py :

from bigbee import *

The error i get is:

ImportError: No Module bigbee.

Please provide a solution.


--
Thomas Morton

Lead Developer || Founder
TomNRob Web Services
www.tomnrob.com
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,763
Messages
2,569,562
Members
45,038
Latest member
OrderProperKetocapsules

Latest Threads

Top