Vielen Dank für die Informationen
Ich verwende MySQL + MySQLdb. Ein...
liefert mir ''format". Damit wäre %s schon einmal die richtige Wahl. Leider bekomme ich weiterhin den Fehler...gegenwärtig an folgendem Beispiel.
Code: Alles auswählen
self.__database = {
'host' : "localhost",
'user' : "root",
'pass' : "1234",
'db' : "test",
}
Code: Alles auswählen
cursor.execute("""CREATE DATABASE IF NOT EXISTS %s""", (self.__database['db'],))
Der Traceback...
Traceback (most recent call last):
File "C:\Temp\Python\2.7.2\Scripts\paster-script.py", line 9, in <module>
load_entry_point('pastescript==1.7.5', 'console_scripts', 'paster')()
File "C:\Temp\Python\2.7.2\lib\site-packages\pastescript-1.7.5-py2.7.egg\paste\script\command.py", line 104, in run
invoke(command, command_name, options, args[1:])
File "C:\Temp\Python\2.7.2\lib\site-packages\pastescript-1.7.5-py2.7.egg\paste\script\command.py", line 143, in invoke
exit_code = runner.run(args)
File "C:\Temp\Python\2.7.2\lib\site-packages\pastescript-1.7.5-py2.7.egg\paste\script\command.py", line 238, in run
result = self.command()
File "C:\Temp\Python\2.7.2\lib\site-packages\pastescript-1.7.5-py2.7.egg\paste\script\serve.py", line 284, in command
relative_to=base, global_conf=vars)
File "C:\Temp\Python\2.7.2\lib\site-packages\pastescript-1.7.5-py2.7.egg\paste\script\serve.py", line 321, in loadapp
**kw)
File "C:\Temp\Python\2.7.2\lib\site-packages\pastedeploy-1.5.0-py2.7.egg\paste\deploy\loadwsgi.py", line 247, in loadapp
return loadobj(APP, uri, name=name, **kw)
File "C:\Temp\Python\2.7.2\lib\site-packages\pastedeploy-1.5.0-py2.7.egg\paste\deploy\loadwsgi.py", line 272, in loadobj
return context.create()
File "C:\Temp\Python\2.7.2\lib\site-packages\pastedeploy-1.5.0-py2.7.egg\paste\deploy\loadwsgi.py", line 710, in create
return self.object_type.invoke(self)
File "C:\Temp\Python\2.7.2\lib\site-packages\pastedeploy-1.5.0-py2.7.egg\paste\deploy\loadwsgi.py", line 146, in invoke
return fix_call(context.object, context.global_conf, **context.local_conf)
File "C:\Temp\Python\2.7.2\lib\site-packages\pastedeploy-1.5.0-py2.7.egg\paste\deploy\util.py", line 56, in fix_call
val = callable(*args, **kw)
File "C:\Users\User\Documents\Workspace\test\test\config\middleware.py", line 37, in make_app
config = load_environment(global_conf, app_conf)
File "C:\Users\User\Documents\Workspace\test\test\config\environment.py", line 31, in load_environment
config['pylons.app_globals'] = app_globals.Globals(config)
File "C:\Users\User\Documents\Workspace\test\test\lib\app_globals.py", line 23, in __init__
self.pi = Pipeline()
File "C:\Users\User\Documents\Workspace\test\core\pipeline.py", line 37, in __init__
self.__mysql = MYSQLCommunicator()
File "C:\Users\User\Documents\Workspace\test\core\mysqlcommunicator.py", line 47, in __init__
self.__create_database()
File "C:\Users\User\Documents\Workspace\test\core\mysqlcommunicator.py", line 67, in __create_database
cursor.execute("""CREATE DATABASE IF NOT EXISTS %s""", (self.__database['db'],))
File "C:\Temp\Python\2.7.2\lib\site-packages\MySQLdb\cursors.py", line 174, in execute
self.errorhandler(self, exc, value)
File "C:\Temp\Python\2.7.2\lib\site-packages\MySQLdb\connections.py", line 36, in defaulterrorhandler
raise errorclass, errorvalue
_mysql_exceptions.ProgrammingError: (1064, "You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right s
yntax to use near ''test'' at line 1")
Eine Idee an was es liegen könnte?
Gruß Tagiru