473,386 Members | 1,803 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Problems with import

Hi,

I have some problems when importing a library. Suppose I have a
directory /home/user/pythonlib/package in which I have a python-
library called test.py. Now I want to import that, so I put the
following directory into the PYTHONPATH: /home/user/pythonlib and in
my main python script I put:

from package import test.

BUT I get an error:

ImportError: cannot import name test

So how can I test and check what is going on, why python does not find
the library?
Thanks
Alex
Dec 4 '07 #1
1 1137
al******@googlemail.com wrote:
Hi,

I have some problems when importing a library. Suppose I have a
directory /home/user/pythonlib/package in which I have a python-
library called test.py. Now I want to import that, so I put the
following directory into the PYTHONPATH: /home/user/pythonlib and in
my main python script I put:

from package import test.

BUT I get an error:

ImportError: cannot import name test

So how can I test and check what is going on, why python does not find
the library?
Do you have this directory structure?

package/__init__.py
test.py
Only then (with the __init__.py in place, it can be empty) package will be
recognized as such.

Diez
Dec 4 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Katja Filippova | last post by:
hi, Has anybody tried using natural language toolkit (http://nltk.sourceforge.net/) under Python (my version is 2.1.1)? problems: first, I wanted to import a module, as it is written in the...
3
by: Alan Krueger | last post by:
Greetings, I've been able to cache Transformer objects in a Tomcat-based servlet application to avoid unnecessary Transformer rebuilding, except for certain ones on certain machines. I'm...
3
by: deko | last post by:
I've been trying to use the Access Import Wizard to expedite importing data into my mdb. The nice thing about the wizard is that I can import from different file formats - txt, xls, even Outlook -...
1
by: Rolan | last post by:
Perhaps someone has experience these two problems and if there are any fixes or workarounds, I sure would like to know. I'm using Access 97. When exporting data in html from one database that...
1
by: Michael Yanowitz | last post by:
Hello: Below I have included a stripped down version of the GUI I am working on. It contains 2 dialog boxes - one main and one settings. It has the following problems, probably all related, that...
1
by: Mario Lacunza | last post by:
--------- Mensaje reenviado -------- De: Mario Lacunza <mario.lacunza@gmail.com> Para: Lista Python Ing <python-list@python.org> Asunto: Problems with PyGridTableBase Fecha: Sat, 09 Sep 2006...
3
by: sara | last post by:
Very strange behavior, but I suspect some is A2K and some might be for me to correct. Just trying to see if anyone can help and advise. We have a database that's been running for a few years...
1
by: Andrew | last post by:
Hello Everyone I am receiving an error in an application I am working on. The application when its done will be a Dungeons and Dragons Network game. I am having problems with the Networked...
3
by: scoots987 | last post by:
What do others do if you need to import excel files into SQL Server? My main problems are 1) zipcode formatting issues. If the column is a mix of zip and zip+4, I have problems retrieving all...
3
by: John Dann | last post by:
Trying to learn Python here, but getting tangled up with variable scope across functions, modules etc and associated problems. Can anyone advise please? Learning project is a GUI-based...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.