Menu

Commands out of sync; You can't run this comm

Help
Cerin
2008-07-21
2012-09-19
  • Cerin

    Cerin - 2008-07-21

    Trying to run a stored proc, I get the error "Commands out of sync; You can't run this command now". The MySQL documentation on this error is useless, and doesn't seem to apply to the actual SQL in my proc, so I can only assume it's a bug in how MySQLdb wraps the db connection.

    My usage is very simple. I'm simply doing a cursor.execute(...) followed by a cursor.fetchall(). No threads or multiple uses of the same cursor.

     
    • Andy Dustman

      Andy Dustman - 2008-07-21

      Try cursor.callproc(...) instead of cursor.execute(...). Then you'll have to use cursor.nextset() until it returns an empty result set. Read PEP-249 for the correct usage, but note that due to some MySQL design choices, callproc() can't return any out or inout parameters; see the MySQLdb docs as well.

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.