LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 06-20-2007, 11:16 PM   #1
rose_bud4201
Member
 
Registered: Aug 2002
Location: St Louis, MO
Distribution: Xubuntu, RHEL, Solaris 10
Posts: 929

Rep: Reputation: 30
Including python module causing script to abort?


I have an odd problem lately with some of the Python scripts on my website. By commenting out various include statements I tracked it down to one module - MySQLdb. It seems my web hosts had removed it for reasons best known only to themselves. I asked for it to be reinstated, and apparently it was, because I can now go into the Python interpreter and import it successfully.

However, this still doesn't relieve the problem. I wrote a test script to prove it to myself -- when I have the "include MySQLdb" line commented out, my script works. (It's at http://www.cybermenology.com/cgi-bin/test.py and does nothing but print Hi to the screen.) When it's uncommented, it doesn't. Note that the script never actually makes any MySQL calls or uses the module in any way - its sheer presence causes the abort.

Has anyone encountered this before, or know of any diagnostic which I can use to show whether perhaps the reinstated module was compiled with another version of gcc, or... well, anything? I'm about at my wits' end with this thing.

Thanks!
 
Old 06-21-2007, 09:09 PM   #2
3point2
LQ Newbie
 
Registered: Jan 2006
Distribution: Slackware 11.0
Posts: 23

Rep: Reputation: 15
Sanity check:

Does your script say

"include MySQLdb" (which you wrote in your post)

or

"import MySQLdb"? (which is the correct syntax)
 
Old 06-21-2007, 10:43 PM   #3
rose_bud4201
Member
 
Registered: Aug 2002
Location: St Louis, MO
Distribution: Xubuntu, RHEL, Solaris 10
Posts: 929

Original Poster
Rep: Reputation: 30
That's a fabulous question, and sadly the script (not the post) is correct. Import it is :|
 
Old 06-22-2007, 12:31 PM   #4
3point2
LQ Newbie
 
Registered: Jan 2006
Distribution: Slackware 11.0
Posts: 23

Rep: Reputation: 15
Try a test script that does something like this:

Code:
try:
    import MySQLdb
except Exception, e:
    print e
else:
    print "The module seemed to import ok."
By the way, the test script you linked to doesn't print "hi", it just creates an HTML page with "testing!" as the title.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Is 'Can't locate module block-major-xx' causing this system to crash? stshores24 Red Hat 1 10-05-2006 10:01 AM
PHP 5.1.2 module causing apache to not load Jalalabee Linux - Newbie 3 03-31-2006 05:35 PM
Including the header file of a module in kernel code omkarlagu Linux - Newbie 0 02-05-2006 08:55 AM
Module conflict causing network services to fail rollo Linux - Newbie 3 11-01-2005 01:19 PM
Including binary file into bash script Barca Programming 2 07-01-2005 01:45 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 01:37 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration