pymysql only works under IDLE

Chris Rebert clp2 at rebertia.com
Mon Jan 16 20:11:09 EST 2012


On Mon, Jan 16, 2012 at 4:18 PM, Saul Spatz <saul.spatz at gmail.com> wrote:
> 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 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
--
http://rebertia.com



More information about the Python-list mailing list