django.db.utils。OperationalError:附近“????????N”:语法错误

时间:2022-11-19 20:27:49

I'm getting some weird error when i run ./manage.py runserver or migrate command. I checked the files from where the exception is thrown, but no idea

我在跑步时犯了一些奇怪的错误。py运行服务器或迁移命令。我检查了抛出异常的文件,但不知道

Unhandled exception in thread started by <function wrapper at 0x7fd4c73df488>
Traceback (most recent call last):
  File "/home/dummy/RobocopEnv/lib/python2.7/site-packages/django/utils/autoreload.py", line 225, in wrapper
    fn(*args, **kwargs)
  File "/home/dummy/RobocopEnv/lib/python2.7/site-packages/django/core/management/commands/runserver.py", line 112, in inner_run
    self.check_migrations()
  File "/home/dummy/RobocopEnv/lib/python2.7/site-packages/django/core/management/commands/runserver.py", line 164, in check_migrations
    executor = MigrationExecutor(connections[DEFAULT_DB_ALIAS])
  File "/home/dummy/RobocopEnv/lib/python2.7/site-packages/django/db/migrations/executor.py", line 19, in __init__
    self.loader = MigrationLoader(self.connection)
  File "/home/dummy/RobocopEnv/lib/python2.7/site-packages/django/db/migrations/loader.py", line 47, in __init__
    self.build_graph()
  File "/home/dummy/RobocopEnv/lib/python2.7/site-packages/django/db/migrations/loader.py", line 182, in build_graph
    self.applied_migrations = recorder.applied_migrations()
  File "/home/dummy/RobocopEnv/lib/python2.7/site-packages/django/db/migrations/recorder.py", line 59, in applied_migrations
    self.ensure_schema()
  File "/home/dummy/RobocopEnv/lib/python2.7/site-packages/django/db/migrations/recorder.py", line 52, in ensure_schema
    with self.connection.schema_editor() as editor:
  File "/home/dummy/RobocopEnv/lib/python2.7/site-packages/django/db/backends/base/schema.py", line 85, in __enter__
    self.atomic.__enter__()
  File "/home/dummy/RobocopEnv/lib/python2.7/site-packages/django/db/transaction.py", line 190, in __enter__
    connection._start_transaction_under_autocommit()
  File "/home/dummy/RobocopEnv/lib/python2.7/site-packages/django/db/backends/sqlite3/base.py", line 299, in _start_transaction_under_autocommit
    self.cursor().execute("BEGIN")
  File "/home/dummy/RobocopEnv/lib/python2.7/site-packages/django/db/backends/utils.py", line 79, in execute
    return super(CursorDebugWrapper, self).execute(sql, params)
  File "/home/dummy/RobocopEnv/lib/python2.7/site-packages/django/db/backends/utils.py", line 64, in execute
    return self.cursor.execute(sql, params)
  File "/home/dummy/RobocopEnv/lib/python2.7/site-packages/django/db/utils.py", line 97, in __exit__
    six.reraise(dj_exc_type, dj_exc_value, traceback)
  File "/home/dummy/RobocopEnv/lib/python2.7/site-packages/django/db/backends/utils.py", line 62, in execute
    return self.cursor.execute(sql)
  File "/home/dummy/RobocopEnv/lib/python2.7/site-packages/django/db/backends/sqlite3/base.py", line 316, in execute
    return Database.Cursor.execute(self, query)
django.db.utils.OperationalError: near "????????N": syntax error

1 个解决方案

#1


1  

The problem is python build with ucs-2, so rebuild with ucs-4 should be work.

问题是python使用ucs-2构建,所以使用ucs-4重新构建应该是可行的。

Python 2.7.6

Python 2.7.6

wget http://python.org/ftp/python/2.7.6/Python-2.7.6.tar.xz
tar xf Python-2.7.6.tar.xz
cd Python-2.7.6
./configure --prefix=/usr/local --enable-unicode=ucs4 --enable-shared LDFLAGS="-Wl,-rpath /usr/local/lib"
make && make altinstall

#1


1  

The problem is python build with ucs-2, so rebuild with ucs-4 should be work.

问题是python使用ucs-2构建,所以使用ucs-4重新构建应该是可行的。

Python 2.7.6

Python 2.7.6

wget http://python.org/ftp/python/2.7.6/Python-2.7.6.tar.xz
tar xf Python-2.7.6.tar.xz
cd Python-2.7.6
./configure --prefix=/usr/local --enable-unicode=ucs4 --enable-shared LDFLAGS="-Wl,-rpath /usr/local/lib"
make && make altinstall