Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: ord() expected a character, but string of length 0 found #21

Open
tyilo opened this issue Jan 20, 2015 · 0 comments
Open

TypeError: ord() expected a character, but string of length 0 found #21

tyilo opened this issue Jan 20, 2015 · 0 comments

Comments

@tyilo
Copy link

tyilo commented Jan 20, 2015

pyswf spends a lot of time parsing the file (around 10-20 mins) and then it finally fails with:

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-4-75ab7c2ec624> in <module>()
----> 1 get_ipython().magic(u'time swf.movie.SWF(f)')

/usr/local/lib/python2.7/site-packages/IPython/core/interactiveshell.pyc in magic(self, arg_s)
   2203         magic_name, _, magic_arg_s = arg_s.partition(' ')
   2204         magic_name = magic_name.lstrip(prefilter.ESC_MAGIC)
-> 2205         return self.run_line_magic(magic_name, magic_arg_s)
   2206
   2207     #-------------------------------------------------------------------------

/usr/local/lib/python2.7/site-packages/IPython/core/interactiveshell.pyc in run_line_magic(self, magic_name, line)
   2124                 kwargs['local_ns'] = sys._getframe(stack_depth).f_locals
   2125             with self.builtin_trap:
-> 2126                 result = fn(*args,**kwargs)
   2127             return result
   2128

/usr/local/lib/python2.7/site-packages/IPython/core/magics/execution.pyc in time(self, line, cell, local_ns)

/usr/local/lib/python2.7/site-packages/IPython/core/magic.pyc in <lambda>(f, *a, **k)
    191     # but it's overkill for just that one bit of state.
    192     def magic_deco(arg):
--> 193         call = lambda f, *a, **k: f(*a, **k)
    194
    195         if callable(arg):

/usr/local/lib/python2.7/site-packages/IPython/core/magics/execution.pyc in time(self, line, cell, local_ns)
   1123         if mode=='eval':
   1124             st = clock2()
-> 1125             out = eval(code, glob, local_ns)
   1126             end = clock2()
   1127         else:

<timed eval> in <module>()

/usr/local/lib/python2.7/site-packages/swf/movie.pyc in __init__(self, file)
     85         self._header = None
     86         if self._data is not None:
---> 87             self.parse(self._data)
     88
     89     @property

/usr/local/lib/python2.7/site-packages/swf/movie.pyc in parse(self, data)
    141             self._header._frame_rate = data.readFIXED8()
    142             self._header._frame_count = data.readUI16()
--> 143         self.parse_tags(data)
    144
    145

/usr/local/lib/python2.7/site-packages/swf/tag.pyc in parse_tags(self, data, version)
    110         tag = None
    111         while type(tag) != TagEnd:
--> 112             tag = self.parse_tag(data)
    113             if tag:
    114                 #print tag.name

/usr/local/lib/python2.7/site-packages/swf/tag.pyc in parse_tag(self, data)
    128             data.seek(raw_tag.pos_content)
    129             data.reset_bits_pending()
--> 130             tag.parse(data, raw_tag.header.content_length, tag.version)
    131             #except:
    132             #    print "=> tag_error", tag.name

/usr/local/lib/python2.7/site-packages/swf/tag.pyc in parse(self, data, length, version)
    735                     temp.read(1) # reserved, always 0
    736                 a = ord(temp.read(1)) if is_lossless2 else 0xff
--> 737                 r = ord(temp.read(1))
    738                 g = ord(temp.read(1))
    739                 b = ord(temp.read(1))

TypeError: ord() expected a character, but string of length 0 found

Here is the SWF I used: https://a.pomf.se/rhdxca.swf

FFDec can open and parse it correctly in around 2 seconds.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant