Issue #39 new

decoding Unicode is not supported

Arun Mittal
created an issue

Traceback: File "C:\Python27\lib\site-packages\django\core\handlers\base.py" in get_response 111. response = callback(request, callback_args, callback_kwargs) File "D:\workspace\yogasync\codes\yogasync_svn\YogaSync..\YogaSync\syncs\views.py" in exploresyncs 107. return render_to_response( "syncs/explore_syncs.html", context, RequestContext( request, {} ) ) File "C:\Python27\lib\site-packages\django\shortcuts__init__.py" in render_to_response 20. return HttpResponse(loader.render_to_string(*args, kwargs), httpresponse_kwargs) File "C:\Python27\lib\site-packages\django\template\loader.py" in render_to_string 188. return t.render( context_instance ) File "C:\Python27\lib\site-packages\django\template\base.py" in render 123. return self._render(context) File "C:\Python27\lib\site-packages\django\template\base.py" in _render 117. return self.nodelist.render(context) File "C:\Python27\lib\site-packages\django\template\base.py" in render 744. bits.append(self.render_node(node, context)) File "C:\Python27\lib\site-packages\django\template\debug.py" in render_node 73. result = node.render(context) File "C:\Python27\lib\site-packages\django\template\loader_tags.py" in render 127. return compiled_parent._render(context) File "C:\Python27\lib\site-packages\django\template\base.py" in _render 117. return self.nodelist.render(context) File "C:\Python27\lib\site-packages\django\template\base.py" in render 744. bits.append(self.render_node(node, context)) File "C:\Python27\lib\site-packages\django\template\debug.py" in render_node 73. result = node.render(context) File "C:\Python27\lib\site-packages\django\template\loader_tags.py" in render 64. result = block.nodelist.render(context) File "C:\Python27\lib\site-packages\django\template\base.py" in render 744. bits.append(self.render_node(node, context)) File "C:\Python27\lib\site-packages\django\template\debug.py" in render_node 73. result = node.render(context) File "C:\Python27\lib\site-packages\django\template\defaulttags.py" in render 311. return self.nodelist_true.render(context) File "C:\Python27\lib\site-packages\django\template\base.py" in render 744. bits.append(self.render_node(node, context)) File "C:\Python27\lib\site-packages\django\template\debug.py" in render_node 73. result = node.render(context) File "C:\Python27\lib\site-packages\django\template\defaulttags.py" in render 227. nodelist.append(node.render(context)) File "C:\Python27\lib\site-packages\django\template\debug.py" in render 90. output = self.filter_expression.resolve(context) File "C:\Python27\lib\site-packages\django\template\base.py" in resolve 536. new_obj = func(obj, arg_vals) File "D:\workspace\yogasync\codes\yogasync_svn\YogaSync..\YogaSync\SystemFunctions\templatetags\filepath.py" in syncVideoDurationById 281. return CommonYogaSyncUtil().syncVideoDurationById( id ) File "D:\workspace\yogasync\codes\yogasync_svn\YogaSync..\YogaSync\utils\common.py" in syncVideoDurationById 588. vduration = self.syncVideoDuration2( sync, format ) File "D:\workspace\yogasync\codes\yogasync_svn\YogaSync..\YogaSync\utils\common.py" in syncVideoDuration2 621. vduration.append( self.eleVideoDuration( ele.video_path, ele, format ) ) File "D:\workspace\yogasync\codes\yogasync_svn\YogaSync..\YogaSync\utils\common.py" in eleVideoDuration 422. meta = HachoirUtil().readData( os.path.normpath( path ) ) File "D:\workspace\yogasync\codes\yogasync_svn\YogaSync..\YogaSync\utils\hachoir.py" in readData 125. filename, realname = unicodeFilename(fileWithPath), fileWithPath File "C:\Python27\lib\site-packages\hachoir_core\cmd_line.py" in unicodeFilename 40. return unicode(filename, charset)

Exception Type: TemplateSyntaxError at /syncs/explore-syncs/ Exception Value: Caught TypeError while rendering: decoding Unicode is not supported

Here filename= u'D:\workspace\yogasync\codes\yogasync_svn\YogaSync\media\elements\21\video\IPAD\000018-R-En-A.mp4' and charset 'cp1252'

Comments (1)

  1. nneonneo

    Workaround: In your code, check to see if fileWithPath is unicode. If it is, don't pass it through unicodeFilename (just set realname = filename).

    Fix: Have unicodeFilename just pass back the string if isinstance(filename, unicode).

  2. Log in to comment