Tell me more ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

i am an Eventscripts Developer (www.eventscripts.com) and code in Python. It's for Counter-Strike Source. But that's not really important.

I have a local xampp apache2 server with mysql. I started both, mysql and apache to use phpMyAdmin. I am scripting a small Admin-Script/Plugin where the usermanagement is done via MySQL.

All in all, it doesn't seem to be a problem, i thought. I am using "pymysql" and Python 2.7. I connected to mysql successfully and here is my simple mysql-class:

class MySQLError(Exception):
pass

class MySQLClass:        
   def connect(self):
      c = pymysql.connect(host=MYSQL_HOST, port=3306, user=MYSQL_USER, passwd=MYSQL_PASS, db=MYSQL_DB)
      self.cursor = c.cursor()
      if not self.cursor or not c:
         raise MySQLError, 'Failed to connect with MySQL!'
      else:
         es.dbgmsg(0, '[AD] MySQL: Connected!')

   def query(self, query):
      self.cursor.execute(query)

   def results(self):
      return self.cursor

So this class is basicly working, bad written - but working. Note: es.dbgmsg(LEVEL, MESSAGE) - Prints a message into console, just like print.

Now that is the basic information!

Now we come to my Problem! Situation: I am connected with my server (python, mysql class) and at the same time i try to add data to my database. But when i hit "Okay" it just does nothing, the sites loads inifinte time. But if i close my server (disconnect python with mysql) it finished immediately and the row was added.

What can I do to fix that?

share|improve this question

Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.