timknip / pyswf

A Python library to read and write SWF files
https://github.com/timknip/pyswf/wiki
MIT License
158 stars 65 forks source link

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

Open basilinjoe opened 7 years ago

basilinjoe commented 7 years ago

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'

arjunmahishi commented 7 years ago

Got the same error

wizzfizz94 commented 6 years ago

Ive got the same error.

shubingouyang commented 5 years ago

Ive got the same error.

richerdyoung commented 3 years ago

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>