pymysql only works under IDLE

S

Saul Spatz

I've been using pymysql to connect to a database, and it has suddenly stopped working on the one machine (a virtual server) where I really need it to work. I have a function with hard-coded parameters to do the connection, and now I'm getting an error that says, "Can't connect to MySQL server on ....". The strangest thing is that while I can't connect if I run the script from the command line, or from the shell under Wing IDE, I can connect if Irun the script under the IDLE shell.

I noticed that the command line shell prints

Python 2.7.2 (default, Jun 12 2011, 14:24:46) [MSC v.1500 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.

at startup, but the IDLE shell prints

Python 2.7.2 (default, Jun 12 2011, 14:24:46) [MSC v.1500 64 bit (AMD64)] on win32
Type "copyright", "credits" or "license()" for more information.

So, while the first lines are identical, the second lines are different. Is this a different interpreter then? Can anyone tell me what the difference is? I'm hoping that may help me figure out what's gone wrong.

I'm running on Windows 7.

I'll be grateful for any help you can give me.

Saul
 
C

Chris Rebert

I've been using pymysql to connect to a database, and it has suddenly stopped working on the one machine (a virtual server) where I really need it to work.  I have a function with hard-coded parameters to do the connection, and now I'm getting an error that says, "Can't connect to MySQL server on ...".  The strangest thing is that while I can't connect if I runthe script from the command line, or from the shell under Wing IDE, I can connect if I run the script under the IDLE shell.

I noticed that the command line shell prints

Python 2.7.2 (default, Jun 12 2011, 14:24:46) [MSC v.1500 64 bit (AMD64)]on win32
Type "help", "copyright", "credits" or "license" for more information.

at startup, but the IDLE shell prints

Python 2.7.2 (default, Jun 12 2011, 14:24:46) [MSC v.1500 64 bit (AMD64)]on win32
Type "copyright", "credits" or "license()" for more information.

So, while the first lines are identical, the second lines are different.  Is this a different interpreter then?  Can anyone tell me what the difference is?  I'm hoping that may help me figure out what's gone wrong.

You can check the value of `sys.executable` in each to see whether
they're the same, and if not, where the other one is from.

Cheers,
Chris
 
S

Saul Spatz

Thanks a lot; I didn't know about sys.executable. For the record, IDLE is running pythonw.exe. I won't have a chance to test if this helps till tomorrow, unfortunately.
 
S

Saul Spatz

Thanks a lot; I didn't know about sys.executable. For the record, IDLE is running pythonw.exe. I won't have a chance to test if this helps till tomorrow, unfortunately.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,968
Messages
2,570,150
Members
46,696
Latest member
BarbraOLog

Latest Threads

Top