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

my Python lib is broken

Hi,

I think I've broken my python installation (don't know how). All the
packages that are under 'lib' in python installation doesn't work the
way expected:
>>import xml
xml.dom
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'module' object has no attribute 'dom'

but, if I import * from xml, it starts to work again:
>>from xml import *
xml.dom
<module 'xml.dom' from 'C:\Python25\Lib\xml\dom\__init__.pyc'>
Does someone know why is this happening? (I can reinstall my python
2.5, but would like to know how the python lib got broken).

regards,
Bruno

Oct 6 '07 #1
2 1602
2007/10/6, Bruno Rezende <br***************@gmail.com>:
Hi,

I think I've broken my python installation (don't know how). All the
packages that are under 'lib' in python installation doesn't work the
way expected:
>import xml
xml.dom
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'module' object has no attribute 'dom'
This is not broken. It is how packages works.
xml is a package, dom is a package inside xml. If you want to check
the attributes that you get importing xml you do dir(xml)
but, if I import * from xml, it starts to work again:
>from xml import *
Doing that will cause the __init__.py inside package xml to check its
__all__ list and import them all, including dom
>xml.dom
<module 'xml.dom' from 'C:\Python25\Lib\xml\dom\__init__.pyc'>
Does someone know why is this happening? (I can reinstall my python
2.5, but would like to know how the python lib got broken).
This is hapenning because you have installed Python, congratulations =)
>
regards,
Bruno

--
http://mail.python.org/mailman/listinfo/python-list

--
-- Guilherme H. Polo Goncalves
Oct 6 '07 #2
Thanks for the information! Indeed, I was geting an error when trying
to do:

from xml.dom import minidom

but it was because there is a xml.py file inside the same package, so
it happens a conflict...

On Oct 6, 9:22 am, "Guilherme Polo" <ggp...@gmail.comwrote:
2007/10/6, Bruno Rezende <brunovianareze...@gmail.com>:
Hi,
I think I've broken my python installation (don't know how). All the
packages that are under 'lib' in python installation doesn't work the
way expected:
>>import xml
>>xml.dom
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'module' object has no attribute 'dom'

This is not broken. It is how packages works.
xml is a package, dom is a package inside xml. If you want to check
the attributes that you get importing xml you do dir(xml)
but, if I import * from xml, it starts to work again:
>>from xml import *

Doing that will cause the __init__.py inside package xml to check its
__all__ list and import them all, including dom
>>xml.dom
<module 'xml.dom' from 'C:\Python25\Lib\xml\dom\__init__.pyc'>
Does someone know why is this happening? (I can reinstall my python
2.5, but would like to know how the python lib got broken).

This is hapenning because you have installed Python, congratulations =)
regards,
Bruno
--
http://mail.python.org/mailman/listinfo/python-list

--
-- Guilherme H. Polo Goncalves

Oct 6 '07 #3

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

Similar topics

2
by: Kurt B. Kaiser | last post by:
Patch / Bug Summary ___________________ Patches : 240 open ( -1) / 2655 closed (+15) / 2895 total (+14) Bugs : 766 open ( +0) / 4514 closed (+22) / 5280 total (+22) RFE : 155 open...
12
by: BartlebyScrivener | last post by:
Sorry, I have a knack for making things more difficult than they need to be. I'm on Windows XP and waiting for the ActiveState release of Python 2.5. I want to experiment with sqlite and I see that...
852
by: Mark Tarver | last post by:
How do you compare Python to Lisp? What specific advantages do you think that one has over the other? Note I'm not a Python person and I have no axes to grind here. This is just a question for...
13
by: Steven Bethard | last post by:
Jean-Paul Calderone <exarkun@divmod.comwrote: Interesting. Could you give a few illustrations of this? (I didn't run into the same problem at all, so I'm curious.) Steve
15
by: John Nagle | last post by:
I've been installing Python and its supporting packages on a dedicated server with Fedora Core 6 for about a day now. This is a standard dedicated rackmount server in a colocation facility,...
8
by: Fett | last post by:
I am trying to find a wrapper to do linear programming within python. I am using an ubuntu machine and I have apt-get'd lp_solve, which works just fine. If someone knows of a wrapper that will work...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

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.