I'm working on my first Django app (a photoalbum) and ran across a
problem with Unicode filenames (on windows XP).

I'm storing directory names in a database. At first I was reading the
directory-names as plain strings, and all was well. Then I ran across a
file that was in some strange (cyrillic) encoding and the database
(which was configured for UTF-8 encoding) rejected the string.
So I added a small bit of code to read the files using Unicode
expecting this to solve my problem -- but no! I got a new error, and
one that quite baffles me.

Copy-paste from the webpage with error into a plain-text field doesn't
look so good but I'll try it anyways:

Exception Type:         OperationalError
Exception Value:        command string is a null pointer
Exception Location:
        c:\Python24\lib\site-packages\django\core\db\base.py in execute, line
9

#
c:\Python24\lib\site-packages\django\core\handlers\base.py in
get_response

  73. response = callback(request, *callback_args, **callback_kwargs)
...

[...]
▶ Local vars
Variable        Value
DEBUG
True
INTERNAL_IPS
()
ROOT_URLCONF
'PhotoAlbum.urls'
callback
<function dir_view at 0x01513830>
callback_args
()
callback_kwargs
{'path': 'DownloadedOtherPhotos'}
db
<module 'django.core.db' from
'c:\Python24\lib\site-packages\django\core\db\__init__.pyc'>
e
<psycopg.OperationalError instance at 0x01518AD0>
exceptions
<module 'django.core.exceptions' from
'c:\Python24\lib\site-packages\django\core\exceptions.pyc'>
mail_admins
<function mail_admins at 0x014DFF70>
middleware_method
<bound method XViewMiddleware.process_view of
<django.middleware.doc.XViewMiddleware instance at 0x014F6198>>
path
'/PhotoAlbum/DownloadedOtherPhotos/'
request
<DjangoRequest GET:<MultiValueDict: {}>, POST:<MultiValueDict: {}>,
COOKIES:{'sessionid': '9ae3f35934e02056af604647039a1263'}, [...]

c:\Documents and Settings\leeuwt\My
Documents\Python\DjangoProjects\PhotoAlbum\..\PhotoAlbum\apps\photoalbum\views.py
in dir_view
  25. dirutils.sync_dir_with_fs(d) ...

c:\Documents and Settings\leeuwt\My
Documents\Python\DjangoProjects\PhotoAlbum\..\PhotoAlbum\apps\photoalbum\dirutils.py
in sync_dir_with_fs
  68. new_files = _sync(sub_files, d.get_picture_list(), d,
pictures.Picture) ...

c:\Documents and Settings\leeuwt\My
Documents\Python\DjangoProjects\PhotoAlbum\..\PhotoAlbum\apps\photoalbum\dirutils.py
in _sync
  52. item.save() ...

c:\Python24\lib\site-packages\django\utils\functional.py in _curried
   2. return args[0](*(args[1:]+moreargs), **dict(kwargs.items() +
morekwargs.items())) ...

c:\Python24\lib\site-packages\django\core\meta\__init__.py in
method_save
1025. ','.join(placeholders)), db_values) ...

c:\Python24\lib\site-packages\django\core\db\base.py in execute
   9. result = self.cursor.execute(sql, params) ...



Django version: trunk as of revision 2145.
Database: PostgreSQL 8.1.2 for Windows
PsycoPG: win-psycopg24-pg8.0.zip (don't know more version details,
sorry!)
Python: 2.4.2
OS: WinXP, SP2


Can anyone help me to explain this error 'command string is a null
pointer' and help me to make it go away?
Would be much appreciated!


Cheers,

--Tim

Reply via email to