473,395 Members | 2,446 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.

Have I broken my installation?

Hi folks,

I have an old Linux box that I am messing about with Python on. The
RedHat installed version is 1.5 something so I have built & installed
2.2.2 in /opt/python.

I've started trying to play with XML and ran into an error when
attempting to parse a document:
Traceback (most recent call last):
File "/mnt/hugedisk/share/MattsMovableType/stb/stb.cgi", line 90, in ?
documentElem = parse( rssFile )
File "/opt/python/lib/python2.2/xml/dom/minidom.py", line 962, in parse
return _doparse(pulldom.parse, args, kwargs)
File "/opt/python/lib/python2.2/xml/dom/minidom.py", line 953, in _doparse
events = apply(func, args, kwargs)
File "/opt/python/lib/python2.2/xml/dom/pulldom.py", line 328, in parse
parser = xml.sax.make_parser()
File "/opt/python/lib/python2.2/xml/sax/__init__.py", line 93, in make_parser
raise SAXReaderNotAvailable("No parsers found", None)
xml.sax._exceptions.SAXReaderNotAvailable: No parsers found
Googling around it seems like I needed to build XML support when I
built Python. I'm not sure what I should have done differently when I
built in order to make that happen. The other option on offer
appeared to be installing PyXML.

I duly downloaded PyXML 0.8.2 and installed it (again into /opt/python
using --prefix).

Now instead of the previous error I get a different problem entirely:
Traceback (most recent call last):
File "/mnt/hugedisk/share/MattsMovableType/stb/stb.cgi", line 18, in ?
from xml.dom.minidom import parse, Document
File "./xml.py", line 2, in ?
from xml.dom.minidom import parse
ImportError: No module named dom.minidom


I'm pretty sure I had a module dom.minidom before as it is the import
statement that is raising the exception and it didn't prior to
installing PyXML, I was previously calling parse() and Document().

So did I make a mistake installing PyXML? Can anyone advise me on
what my next steps should be?

Many thanks,

Matt

---
Systems Engineer, Hipbone(EMEA) Ltd.
3000 Hillswood drive, Chertsey, Surrey, KT16 0RS
Tel: 44-1932-895902 Mob: 44-7980-237-380
Jul 18 '05 #1
10 5590
Matt Mower <mm****@novissio.com> writes:
Googling around it seems like I needed to build XML support when I
built Python. I'm not sure what I should have done differently when I
built in order to make that happen.
You should have edited Modules/Setup, to activate pyexpat. Before
that, you probably should have installed a more recent Expat version
than the one shipped with Redhat.
Now instead of the previous error I get a different problem entirely:
Traceback (most recent call last):
File "/mnt/hugedisk/share/MattsMovableType/stb/stb.cgi", line 18, in ?
from xml.dom.minidom import parse, Document
File "./xml.py", line 2, in ?
from xml.dom.minidom import parse
ImportError: No module named dom.minidom


I'm pretty sure I had a module dom.minidom before as it is the import
statement that is raising the exception and it didn't prior to
installing PyXML, I was previously calling parse() and Document().

So did I make a mistake installing PyXML?


This is uncertain. Does this also happen when you invoke Python from
the command line? If so, what happens if you do

import xml
print xml
import xml.dom
print xml.dom
import xml.dom.minidom
print xml.dom.minidom

If not, what happens if you do the same in the CGI script?

Regards,
Martin
Jul 18 '05 #2
Hi Martin,

Thanks for responding. My answers are below.

On 28 Jun 2003 17:53:52 +0200, ma****@v.loewis.de (Martin v. Löwis)
wrote:
I'm pretty sure I had a module dom.minidom before as it is the import
statement that is raising the exception and it didn't prior to
installing PyXML, I was previously calling parse() and Document().

So did I make a mistake installing PyXML?


This is uncertain. Does this also happen when you invoke Python from
the command line? If so, what happens if you do

import xml
print xml
import xml.dom
print xml.dom
import xml.dom.minidom
print xml.dom.minidom


It turns out I made a bad choice naming my test program 'xml.py'. I
discovered that these commands failed in the directory I was working
on the script in, but succeeded elsewhere.

I guess I didn't realise that my local files could interfere with
importing from Pythons libraries. Stupid mistake on my part!

Thanks again!

Matt

---
Systems Engineer, Hipbone(EMEA) Ltd.
3000 Hillswood drive, Chertsey, Surrey, KT16 0RS
Tel: 44-1932-895902 Mob: 44-7980-237-380
Jul 18 '05 #3
Matt Mower <mm****@novissio.com> writes:
Nothing in the environment or access to the file system suggests to me
why it works as for my account but not for the nobody account.


So I'll ask my questions again: Print xml, xml.dom, xml.dom.minidom
both in the interactive mode and the CGI script.

Martin

Jul 18 '05 #4
Hi Martin,

On 28 Jun 2003 19:49:58 +0200, ma****@v.loewis.de (Martin v. Löwis)
wrote:
Matt Mower <mm****@novissio.com> writes:
Nothing in the environment or access to the file system suggests to me
why it works as for my account but not for the nobody account.


So I'll ask my questions again: Print xml, xml.dom, xml.dom.minidom
both in the interactive mode and the CGI script.


Sorry, sometimes I don't listen so good.

Interactively as user 'nobody':

|>>> import xml
|>>> print xml
|<module 'xml' from '/opt/python/lib/python2.2/xml/__init__.pyc'>
|>>> import xml.dom
|>>> print xml.dom
|<module 'xml.dom' from '/opt/python/lib/python2.2/xml/dom/__init__.pyc'>
|>>> import xml.dom.minidom
|>>> print xml.dom.minidom
|<module 'xml.dom.minidom' from '/opt/python/lib/python2.2/xml/dom/minidom.pyc'>

via CGI webserver running as user 'nobody':

|<module 'xml' from '/opt/python/lib/python2.2/xml/__init__.pyc'>
|<module 'xml.dom' from '/opt/python/lib/python2.2/xml/dom/__init__.pyc'>
|<module 'xml.dom.minidom' from '/opt/python/lib/python2.2/xml/dom/minidom.pyc'>

Regards,

Matt

---
Systems Engineer, Hipbone(EMEA) Ltd.
3000 Hillswood drive, Chertsey, Surrey, KT16 0RS
Tel: 44-1932-895902 Mob: 44-7980-237-380
Jul 18 '05 #5
Matt Mower <mm****@novissio.com> writes:
|>>> import xml
|>>> print xml
|<module 'xml' from '/opt/python/lib/python2.2/xml/__init__.pyc'>
|>>> import xml.dom
|>>> print xml.dom
|<module 'xml.dom' from '/opt/python/lib/python2.2/xml/dom/__init__.pyc'>
|>>> import xml.dom.minidom
|>>> print xml.dom.minidom
|<module 'xml.dom.minidom' from '/opt/python/lib/python2.2/xml/dom/minidom.pyc'>


And you said you have PyXML installed? This sounds unlikely: minidom
would come from site-packages/_xmlplus if you had.

Regards,
Martin
Jul 18 '05 #6
I think you should have installed a recent version of Expat.

-aj

--On Samstag, 28. Juni 2003 16:23 Uhr +0100 Matt Mower
<mm****@novissio.com> wrote:
Hi folks,

I have an old Linux box that I am messing about with Python on. The
RedHat installed version is 1.5 something so I have built & installed
2.2.2 in /opt/python.

I've started trying to play with XML and ran into an error when
attempting to parse a document:
Traceback (most recent call last):
File "/mnt/hugedisk/share/MattsMovableType/stb/stb.cgi", line 90, in ?
documentElem = parse( rssFile )
File "/opt/python/lib/python2.2/xml/dom/minidom.py", line 962, in parse
return _doparse(pulldom.parse, args, kwargs)
File "/opt/python/lib/python2.2/xml/dom/minidom.py", line 953, in
_doparse events = apply(func, args, kwargs)
File "/opt/python/lib/python2.2/xml/dom/pulldom.py", line 328, in parse
parser = xml.sax.make_parser()
File "/opt/python/lib/python2.2/xml/sax/__init__.py", line 93, in
make_parser raise SAXReaderNotAvailable("No parsers found", None)
xml.sax._exceptions.SAXReaderNotAvailable: No parsers found


Googling around it seems like I needed to build XML support when I
built Python. I'm not sure what I should have done differently when I
built in order to make that happen. The other option on offer
appeared to be installing PyXML.

I duly downloaded PyXML 0.8.2 and installed it (again into /opt/python
using --prefix).

Now instead of the previous error I get a different problem entirely:
Traceback (most recent call last):
File "/mnt/hugedisk/share/MattsMovableType/stb/stb.cgi", line 18, in ?
from xml.dom.minidom import parse, Document
File "./xml.py", line 2, in ?
from xml.dom.minidom import parse
ImportError: No module named dom.minidom


I'm pretty sure I had a module dom.minidom before as it is the import
statement that is raising the exception and it didn't prior to
installing PyXML, I was previously calling parse() and Document().

So did I make a mistake installing PyXML? Can anyone advise me on
what my next steps should be?

Many thanks,

Matt

---
Systems Engineer, Hipbone(EMEA) Ltd.
3000 Hillswood drive, Chertsey, Surrey, KT16 0RS
Tel: 44-1932-895902 Mob: 44-7980-237-380
--
http://mail.python.org/mailman/listinfo/python-list


Jul 18 '05 #7
Hi Martin,

On 28 Jun 2003 20:24:19 +0200, ma****@v.loewis.de (Martin v. Löwis)
wrote:
Matt Mower <mm****@novissio.com> writes:
|>>> import xml
|>>> print xml
|<module 'xml' from '/opt/python/lib/python2.2/xml/__init__.pyc'>
|>>> import xml.dom
|>>> print xml.dom
|<module 'xml.dom' from '/opt/python/lib/python2.2/xml/dom/__init__.pyc'>
|>>> import xml.dom.minidom
|>>> print xml.dom.minidom
|<module 'xml.dom.minidom' from '/opt/python/lib/python2.2/xml/dom/minidom.pyc'>


And you said you have PyXML installed? This sounds unlikely: minidom
would come from site-packages/_xmlplus if you had.


The installation instructions that came with my PyXML distro (0.8.2)
said to execute:

python setup.py build
python setup.py install

I made one small adjustment, specifying the --prefix=/opt/python
option to put PyXML in the same directory as Python 2.2.

My entire Python developing experience runs to about an afternoons
worth so I have no idea why PyXML isn't working or isn't being found.

Can you suggest anything?

Thanks,

Matt

---
Systems Engineer, Hipbone(EMEA) Ltd.
3000 Hillswood drive, Chertsey, Surrey, KT16 0RS
Tel: 44-1932-895902 Mob: 44-7980-237-380
Jul 18 '05 #8
On Sat, 28 Jun 2003 21:40:12 +0200, Andreas Jung
<li***@andreas-jung.com> wrote:
I think you should have installed a recent version of Expat.


You and Martin were both correct. This was the essential step.

|<module '_xmlplus' from '/opt/python/lib/python2.2/site-packages/_xmlplus/__init__.pyc'>
|<module 'xml.dom' from '/opt/python/lib/python2.2/site-packages/_xmlplus/dom/__init__.pyc'>
|<module 'xml.dom.minidom' from '/opt/python/lib/python2.2/site-packages/_xmlplus/dom/minidom.pyc'>

Which is what I think Martin was expecting to see earlier.

My thanks to you both.

Regards,

Matt

Jul 18 '05 #9
Matt Mower wrote:
Looks like I spoke a little too soon.

The minimal test script:

from xml.dom.minidom import parse, Document
doc = parse( "...some file..." )
print doc

works, spitting out a reference to a minidom instance.

However the CGI script which is, in a roundabout way, doing exactly
the same thing still comes up with the error:


Whenever there's a difference in behavior between a program in your
shell and in CGI (or someone else's shell), it's almost certainly a
difference in paths. You said that you installed some Python utilities
into some nonstandard places (like /opt/python); that's likely what your
problem is.

--
Erik Max Francis && ma*@alcyone.com && http://www.alcyone.com/max/
__ San Jose, CA, USA && 37 20 N 121 53 W && &tSftDotIotE
/ \ Every astronaut who goes up knows the risks he or she faces.
\__/ Sally Ride
Jul 18 '05 #10
Matt Mower wrote:
I made one small adjustment, specifying the --prefix=/opt/python
option to put PyXML in the same directory as Python 2.2.
Well, that's your problem right there. Note the symptomology of what
Martin von Loewis asked you to test -- it prints different things for
your interactive usage and the CGI script.
My entire Python developing experience runs to about an afternoons
worth so I have no idea why PyXML isn't working or isn't being found.
That's because the problem you're running into here is a difference in
environment between you running the program in your interactive shell
and Apache running it as nobody. It's a general Unix issue, not
specific to Python.
Can you suggest anything?


The problem is that you've installed PyXML in /opt/python, which is a
nonstandard place -- though that isn't in and of itself wrong if you
know what you're doing. You've obviously adjusted your interactive
environment to look in /opt/python, since you're running the scripts
without problems locally, but CGI scripts do not run in your
environment, and so aren't seeing what you've installed in /opt/python,
since that is a nonstandard place. For a quick remedy, add something
like this:

import sys
sys.path.append('/opt/python')

to the top of your script. A more permanent solution would involve
adding it to /usr/local/lib/pythonX.Y/site.py.

--
Erik Max Francis && ma*@alcyone.com && http://www.alcyone.com/max/
__ San Jose, CA, USA && 37 20 N 121 53 W && &tSftDotIotE
/ \ Every astronaut who goes up knows the risks he or she faces.
\__/ Sally Ride
Jul 18 '05 #11

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

Similar topics

0
by: Nick | last post by:
I am using the original relaese (1.0?) of Visual Studio.NET. Whenever I search for a help topic, all the results come back with a title of "a". Yes, just the letter "a". I can click on them, and...
0
by: Michał Januszczyk | last post by:
Hello. I've got the following problem: I created a windows installer project that installs my application. The application works with some files. I want to include some example files with the...
15
by: Jake | last post by:
Not sure if this can be done with javascript but I would like to find a way to detect if an image is missing and replace it with a default image instead of the dreaded RED X showing up. So - Is...
87
by: Sony Music CDs install Malware | last post by:
Whether you are a web surfer or a C++ developer, if you use Windows be cautioned about SONY music CDs. They contain 'viewer' type software that is actually a trojan horse for a "rootkit". The...
1
by: ImageAnalyst | last post by:
Yay!!! They fixed this for VS2005. You can now set the default installation to be "Everyone" instead of "Just Me" and you can control whether you even want those radio button installed in your...
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
9
by: Endless Story | last post by:
My last version of Python was 2.4, running smoothly on XP with path c: \Python24 - no need even to include this path in PATH; everything worked as it's supposed to at the command line. Just...
2
by: Bruno Rezende | last post by:
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: Traceback (most recent call last):...
5
by: Larry Bates | last post by:
Info: Python version: ActivePython 2.5.1.1 Platform: Windows I wanted to install BeautifulSoup today for a small project and decided to use easy_install. I can install other packages just...
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: 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
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...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.