timknip / pyswf

A Python library to read and write SWF files

Home Page:https://github.com/timknip/pyswf/wiki

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

TypeError : unsupported operand type(s) for |: 'int' and 'str'

basilinjoe opened this issue · comments

Traceback (most recent call last):
File "osWalk.py", line 22, in
convertToSvg(path)
File "osWalk.py", line 10, in convertToSvg
swf = SWF(file)
File "build\bdist.win32\egg\swf\movie.py", line 100, in init
self.parse(self._data)
File "build\bdist.win32\egg\swf\movie.py", line 162, in parse
self.parse_tags(data)
File "build\bdist.win32\egg\swf\tag.py", line 163, in parse_tags
tag = self.parse_tag(data)
File "build\bdist.win32\egg\swf\tag.py", line 181, in parse_tag
tag.parse(data, raw_tag.header.content_length, tag.version)
File "build\bdist.win32\egg\swf\tag.py", line 359, in parse
self._shapes = data.readSHAPEWITHSTYLE(self.level)
File "build\bdist.win32\egg\swf\stream.py", line 253, in readSHAPEWITHSTYLE
return SWFShapeWithStyle(self, level, unit_divisor)
File "build\bdist.win32\egg\swf\data.py", line 485, in init
super(SWFShapeWithStyle, self).init(data, level, unit_divisor)
File "build\bdist.win32\egg\swf\data.py", line 57, in init
self.parse(data, level)
File "build\bdist.win32\egg\swf\data.py", line 515, in parse
self.read_shape_records(data, num_fillbits, num_linebits, level)
File "build\bdist.win32\egg\swf\data.py", line 101, in read_shape_records
shape_record = data.readSTRAIGHTEDGERECORD(num_bits)
File "build\bdist.win32\egg\swf\stream.py", line 261, in readSTRAIGHTEDGERECOR
D
return SWFShapeRecordStraightEdge(self, num_bits)
File "build\bdist.win32\egg\swf\data.py", line 567, in init
super(SWFShapeRecordStraightEdge, self).init(data, level)
File "build\bdist.win32\egg\swf\data.py", line 547, in init
self.parse(data, level)
File "build\bdist.win32\egg\swf\data.py", line 573, in parse
if self.general_line_flag or not self.vert_line_flag
File "build\bdist.win32\egg\swf\stream.py", line 114, in readSB
return int32(self.readbits(bits) << shift) >> shift
File "build\bdist.win32\egg\swf\stream.py", line 67, in readbits
return self._read_bytes_aligned(bits // 8)
File "build\bdist.win32\egg\swf\stream.py", line 54, in _read_bytes_aligned
return reduce(lambda x, y: x << 8 | y, buf, 0)
File "build\bdist.win32\egg\swf\stream.py", line 54, in
return reduce(lambda x, y: x << 8 | y, buf, 0)
TypeError: unsupported operand type(s) for |: 'int' and 'str'

Got the same error

Ive got the same error.

Ive got the same error.

win10
python2.7

from swf.movie import SWF
from swf.export import SVGExporter

# create a file object
file = open('./5611.swf', 'rb')

# load and parse the SWF
swf = SWF(file)

# create the SVG exporter
svg_exporter = SVGExporter()

# export!
svg = swf.export(svg_exporter)

# save the SVG
open('1.svg', 'wb').write(svg.read())

error

PS D:\python2\test> python .\svg.py
Traceback (most recent call last):
  File ".\svg.py", line 8, in <module>
    swf = SWF(file)
  File "build\bdist.win-amd64\egg\swf\movie.py", line 100, in __init__
  File "build\bdist.win-amd64\egg\swf\movie.py", line 162, in parse
  File "build\bdist.win-amd64\egg\swf\tag.py", line 163, in parse_tags
  File "build\bdist.win-amd64\egg\swf\tag.py", line 181, in parse_tag
  File "build\bdist.win-amd64\egg\swf\tag.py", line 359, in parse
  File "build\bdist.win-amd64\egg\swf\stream.py", line 253, in readSHAPEWITHSTYLE
  File "build\bdist.win-amd64\egg\swf\data.py", line 485, in __init__
  File "build\bdist.win-amd64\egg\swf\data.py", line 57, in __init__
  File "build\bdist.win-amd64\egg\swf\data.py", line 515, in parse
  File "build\bdist.win-amd64\egg\swf\data.py", line 103, in read_shape_records
  File "build\bdist.win-amd64\egg\swf\stream.py", line 257, in readCURVEDEDGERECORD
  File "build\bdist.win-amd64\egg\swf\data.py", line 597, in __init__
  File "build\bdist.win-amd64\egg\swf\data.py", line 547, in __init__
  File "build\bdist.win-amd64\egg\swf\data.py", line 600, in parse
  File "build\bdist.win-amd64\egg\swf\stream.py", line 114, in readSB
  File "build\bdist.win-amd64\egg\swf\stream.py", line 67, in readbits
  File "build\bdist.win-amd64\egg\swf\stream.py", line 54, in _read_bytes_aligned
  File "build\bdist.win-amd64\egg\swf\stream.py", line 54, in <lambda>
TypeError: unsupported operand type(s) for |: 'int' and 'str'
PS D:\python2\test>