I got this error in a Python script - call it X - which until yesterday ran without problem:
OperationalError: (2005, "Unknown MySQL Server Host 'mysql4db.gradwell.net' (2)")
X uses a module - call it db - which connects to MySQL using MySQLdb. Module X uses functions in db to connect to the database and retrieve results.
Module X also calls a function in db which opens a separate connection to the database and retrieves some resuls. The error occurs after db has retrieved results. It was reproducible, not a one off thing, and I fixed it by passing db the first connection so it did not need to open another. I cannot understand how this could be a DNS error. I think it is something else. I wonder could it result from being careless about closing connections?
MySQLdb v1.0.0, MtSQL server 4.1.7-log. Python is version 2.3.4. The OS is 'FreeBSD 4.8-STABLE'.
Peter
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
That message comes from the MySQL client library, so I don't think it's any way it can be a MySQLdb error. But try MySQLdb-1.1.9 anyway. I don't think it has anything to do with closing or not closing connections; you'd get a different error.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I got this error in a Python script - call it X - which until yesterday ran without problem:
OperationalError: (2005, "Unknown MySQL Server Host 'mysql4db.gradwell.net' (2)")
X uses a module - call it db - which connects to MySQL using MySQLdb. Module X uses functions in db to connect to the database and retrieve results.
Module X also calls a function in db which opens a separate connection to the database and retrieves some resuls. The error occurs after db has retrieved results. It was reproducible, not a one off thing, and I fixed it by passing db the first connection so it did not need to open another. I cannot understand how this could be a DNS error. I think it is something else. I wonder could it result from being careless about closing connections?
MySQLdb v1.0.0, MtSQL server 4.1.7-log. Python is version 2.3.4. The OS is 'FreeBSD 4.8-STABLE'.
Peter
That message comes from the MySQL client library, so I don't think it's any way it can be a MySQLdb error. But try MySQLdb-1.1.9 anyway. I don't think it has anything to do with closing or not closing connections; you'd get a different error.
OK, thanks for your help - and the module too. (I don't think it "sucks rocks" whatever that means!)