Opened 16 years ago

Closed 16 years ago

#6312 closed (fixed)

manage.py dbshell and mysql problem on Windows

Reported by: trung Owned by: nobody
Component: Uncategorized Version: dev
Severity: Keywords: dbshell
Cc: 0.97 pre Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

manage.py dbshell on windows is so strange. I am using mysql as my backend database.
After changing the client.py file in site-packages\django\db\backends\mysql it runs but I cannot do anything with it. It closes immediately when I type something.

client.py


from django.conf import settings
import os

def runshell():

args = []
db = settings.DATABASE_OPTIONS.get('db', settings.DATABASE_NAME)
user = settings.DATABASE_OPTIONS.get('user', settings.DATABASE_USER)
passwd = settings.DATABASE_OPTIONS.get('passwd', settings.DATABASE_PASSWORD)
host = settings.DATABASE_OPTIONS.get('host', settings.DATABASE_HOST)
port = settings.DATABASE_OPTIONS.get('port', settings.DATABASE_PORT)
defaults_file = settings.DATABASE_OPTIONS.get('read_default_file')
# Seems to be no good way to set sql_mode with CLI


if defaults_file:

args += % defaults_file

if user:

args += % user

if passwd:

args += % passwd

if host:

args += % host

if port:

args += % port

if db:

args += [db]


del args[0]

os.execvp('mysql', args)

Change History (1)

comment:1 by trung, 16 years ago

Resolution: fixed
Status: newclosed

After adding two space characters in arguments, it works !

if defaults_file:

args += % defaults_file

if user:

args += % user

if passwd:

args += % passwd

if host:

args += % host

if port:

args += % port

if db:

args += % db


del args[0]
#print args
os.execvp('mysql', args)

Note: See TracTickets for help on using tickets.
Back to Top