473,395 Members | 1,978 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,395 software developers and data experts.

can't figure out error: module has no attribute...

but it seems to depend on from where I start the Python shell.

so I've got a module selfservicelabels.py with some variables defined,
like this:
BtnSave = "link=label.save"
DeliveryAutomaat = "//input[@id='deliveryMethod' and @value='AU']"
This module is in the Lib directory.

Now when I do
import selfservicelabels
selfservicelabels.BtnSave
-> link=nmbs.label.save
selfservicelabels.DeliveryAutomaat
-> AttributeError: 'module' object has no attribute
'DeliveryAutomaat'

to make it more strange: PyCrust and Idle recognise DeliveryAutomaat
perfectly.
Everything above is done with Python 2.4.3 on Windows XP SP2

So after some testing it seems to depend on from which partition I
start Python.
So open commandline and navigate to a dir on C: everything works
perfectly.
Close python shell en navigate to D: some variables in
selfservicelabels.py are not known.
What is going on here? Is this a known error?

May 23 '06 #1
3 1718
Chris_147 wrote:
but it seems to depend on from where I start the Python shell.

so I've got a module selfservicelabels.py with some variables defined,
like this:
BtnSave = "link=label.save"
DeliveryAutomaat = "//input[@id='deliveryMethod' and @value='AU']"
This module is in the Lib directory.

Now when I do
import selfservicelabels
selfservicelabels.BtnSave
-> link=nmbs.label.save
selfservicelabels.DeliveryAutomaat
-> AttributeError: 'module' object has no attribute
'DeliveryAutomaat'

to make it more strange: PyCrust and Idle recognise DeliveryAutomaat
perfectly.
Everything above is done with Python 2.4.3 on Windows XP SP2

So after some testing it seems to depend on from which partition I
start Python.
Probably you have multiple copies of selfservicelabels.py or an old
selfservicelabels.pyc that is being imported. Try
import selfservicelabels
print selfservicelabels.__file__

to see where the import is coming from.

Kent
So open commandline and navigate to a dir on C: everything works
perfectly.
Close python shell en navigate to D: some variables in
selfservicelabels.py are not known.
What is going on here? Is this a known error?

May 23 '06 #2
Thanks for the reply.

you are indeed right, they were included from different places.
from C:\Python24\Lib and D:\mydir

But the strange thing is:
anywhere on C: the file from C:\Python24\Lib was included.
in D:\mydir the one from that directory
BUT: anywhere else on D: apparantly the one from D:\mydir was included
?!
I would expect it would come from c:\Python24\Lib.

Now I changed the files and of course I cannot reproduce it anymore.
Oh well, now it works.

May 24 '06 #3
"Chris_147" <ch************@gmail.com> wrote:
Thanks for the reply.

you are indeed right, they were included from different places.
from C:\Python24\Lib and D:\mydir

But the strange thing is:
anywhere on C: the file from C:\Python24\Lib was included.
in D:\mydir the one from that directory
BUT: anywhere else on D: apparantly the one from D:\mydir was included
?!
I would expect it would come from c:\Python24\Lib.


** PLEASE ** do not copy your OWN files into c:\Python24\Lib. That
directory is intended to contain ONLY the Python standard library.

Modules that are part of a single project should be in a common directory
for that project. Modules that are of general interest to you for multiple
projects should be in \Python24\Lib\site-packages.
--
- Tim Roberts, ti**@probo.com
Providenza & Boekelheide, Inc.
May 26 '06 #4

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

Similar topics

4
by: Tjerk Wolterink | last post by:
I've xml code like this: roles.xml: <?xml version="1.0" encoding="ISO-8859-1"?> <roles xmlns="http://www.wolterinkwebdesign.com/xml/roles"> <!-- ! The admin role. ! And admin should have...
6
by: scottyman | last post by:
I can't make this script work properly. I've gone as far as I can with it and the rest is out of my ability. I can do some html editing but I'm lost in the Java world. The script at the bottom of...
4
by: HMS Surprise | last post by:
The snippet below causes an attribute error. AttributeError: module 'urllib' has no attribute 'urlopen' I am using python 2.2.3. According to the documentation at C: \Python22\Doc\lib urllib...
0
by: Mensanator | last post by:
Python 2.6b1 installed ok on my XP laptop but not my Vista desktop. First I got a strange application log error: Activation context generation failed for "C:\Python\Dlls\_socket.pyd". Error...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

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.