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

Print SWF(file) not working.

jdcrunchman opened this issue · comments

from swf.movie import SWF <--- works fine
file = open('CT12KORJ001.swf', 'rb' ) <---- works fine
print SWF(file)

Traceback (most recent call last):
  File "", line 1, in
  File "build/bdist.macosx-10.8-intel/egg/swf/movie.py", line 87, in init
  File "build/bdist.macosx-10.8-intel/egg/swf/movie.py", line 143, in parse
  File "build/bdist.macosx-10.8-intel/egg/swf/tag.py", line 112, in parse_tags

Why am I getting this? Where have I made my mistake, Did I leave anything out? Did the install go badly? It didn't indicate so.

Please also reply to my email - jdcrunchman@gmail.com

John

The stack trace is not complete, could you paste the complete one?

Yes, here's the full stach trace

swf = SWF(file)
Traceback (most recent call last):
File "", line 1, in
File "build/bdist.macosx-10.8-intel/egg/swf/movie.py", line 87, in
init
File "build/bdist.macosx-10.8-intel/egg/swf/movie.py", line 143, in parse
File "build/bdist.macosx-10.8-intel/egg/swf/tag.py", line 112, in
parse_tags
File "build/bdist.macosx-10.8-intel/egg/swf/tag.py", line 130, in
parse_tag
File "build/bdist.macosx-10.8-intel/egg/swf/tag.py", line 1313, in parse
File "build/bdist.macosx-10.8-intel/egg/swf/stream.py", line 200, in
readSHAPE
File "build/bdist.macosx-10.8-intel/egg/swf/data.py", line 50, in init
File "build/bdist.macosx-10.8-intel/egg/swf/data.py", line 56, in parse
File "build/bdist.macosx-10.8-intel/egg/swf/data.py", line 92, in
read_shape_records
File "build/bdist.macosx-10.8-intel/egg/swf/stream.py", line 216, in
readSTYLECHANGERECORD
File "build/bdist.macosx-10.8-intel/egg/swf/data.py", line 605, in
init
File "build/bdist.macosx-10.8-intel/egg/swf/data.py", line 522, in
init
File "build/bdist.macosx-10.8-intel/egg/swf/data.py", line 620, in parse
File "build/bdist.macosx-10.8-intel/egg/swf/stream.py", line 220, in
readFILLSTYLE
File "build/bdist.macosx-10.8-intel/egg/swf/data.py", line 757, in
init
File "build/bdist.macosx-10.8-intel/egg/swf/data.py", line 770, in parse
Exception: ('Unknown fill style type: 0x36', 1)

On Wed, Jun 25, 2014 at 3:27 AM, Dušan Maliarik notifications@github.com
wrote:

The stack trace is not complete, could you paste the complete one?


Reply to this email directly or view it on GitHub
#16 (comment).

Here is a sample SWF file I've attached that causes this problem. I sure
would like to know whats going on.

On Wed, Jun 25, 2014 at 4:47 AM, John Draper jdcrunchman@gmail.com wrote:

Yes, here's the full stach trace

swf = SWF(file)
Traceback (most recent call last):
File "", line 1, in
File "build/bdist.macosx-10.8-intel/egg/swf/movie.py", line 87, in
init
File "build/bdist.macosx-10.8-intel/egg/swf/movie.py", line 143, in parse
File "build/bdist.macosx-10.8-intel/egg/swf/tag.py", line 112, in
parse_tags
File "build/bdist.macosx-10.8-intel/egg/swf/tag.py", line 130, in
parse_tag
File "build/bdist.macosx-10.8-intel/egg/swf/tag.py", line 1313, in parse
File "build/bdist.macosx-10.8-intel/egg/swf/stream.py", line 200, in
readSHAPE
File "build/bdist.macosx-10.8-intel/egg/swf/data.py", line 50, in
init
File "build/bdist.macosx-10.8-intel/egg/swf/data.py", line 56, in parse
File "build/bdist.macosx-10.8-intel/egg/swf/data.py", line 92, in
read_shape_records
File "build/bdist.macosx-10.8-intel/egg/swf/stream.py", line 216, in
readSTYLECHANGERECORD
File "build/bdist.macosx-10.8-intel/egg/swf/data.py", line 605, in
init
File "build/bdist.macosx-10.8-intel/egg/swf/data.py", line 522, in
init
File "build/bdist.macosx-10.8-intel/egg/swf/data.py", line 620, in parse
File "build/bdist.macosx-10.8-intel/egg/swf/stream.py", line 220, in
readFILLSTYLE
File "build/bdist.macosx-10.8-intel/egg/swf/data.py", line 757, in
init
File "build/bdist.macosx-10.8-intel/egg/swf/data.py", line 770, in parse
Exception: ('Unknown fill style type: 0x36', 1)

On Wed, Jun 25, 2014 at 3:27 AM, Dušan Maliarik notifications@github.com
wrote:

The stack trace is not complete, could you paste the complete one?


Reply to this email directly or view it on GitHub
#16 (comment).

You didn't attach the file :)

It seems your SWF contains an invalid fillStyle 0x36...
Could be that recent versions of Flash introduced a new fillStyle.
What Flash version did you use to create this SWF?

A possible workaround would be to save your movie as an older version like 10.

Note that pyswf hasn't been updated for quite a while, so pyswf may fail on SWF versions 11 or higher.

Good question. This SWF file came from the Thailand Yellow Pages CD, and we wanted to be able to extract text data from it.

Sent from my iPad

On Jun 26, 2014, at 8:12 PM, timknip notifications@github.com wrote:

You didn't attach the file :)

It seems your SWF contains an invalid fillStyle 0x36...
Could be that recent versions of Flash introduced a new fillStyle.
What Flash version did you use to create this SWF?

Is there anyway to modify the python code to ignore this full style.
A possible workaround would be to save your movie as an older version like 10.

It's not really a movie, it's a static SWF file. By the way, I delegated Bob Ackerman to take over this project, he was CCed in this message, you should work with him. I had to detach myself from this project due to health reasons. Back pain so intense, I had to go to hospital here In Bangkok.

Where are you located? Need to know, for time zone reasons.

Note that pyswf hasn't been updated for quite a while, so pyswf may fail on SWF versions 11 or higher.

Is there anyway we can do something about that? Or is there another python module that's newer?

John


Reply to this email directly or view it on GitHub.

interesting that there is a fill style in a supposedly pure text file. maybe the font is included in the text in which case it won't be a simple matter of exporting some unicode text. is there a standard thai alphabet in unicode?
perhaps build the module without throwing an exception on invalid style? source is on github.
interesting that it says the readme was updated 1 month ago, also, the parser it is based on was updated 2 months ago, but not pyswf. so, perhaps, we can drop in the newer parser into pyswf.
is tim interested in doing this project or is he just a helpful resource? would we collaborate?

On Jun 26, 2014, at 7:39 AM, John Draper jdcrunchman@gmail.com wrote:

Good question. This SWF file came from the Thailand Yellow Pages CD, and we wanted to be able to extract text data from it.

Sent from my iPad

On Jun 26, 2014, at 8:12 PM, timknip notifications@github.com wrote:

You didn't attach the file :)

It seems your SWF contains an invalid fillStyle 0x36...
Could be that recent versions of Flash introduced a new fillStyle.
What Flash version did you use to create this SWF?

Is there anyway to modify the python code to ignore this full style.
A possible workaround would be to save your movie as an older version like 10.

It's not really a movie, it's a static SWF file. By the way, I delegated Bob Ackerman to take over this project, he was CCed in this message, you should work with him. I had to detach myself from this project due to health reasons. Back pain so intense, I had to go to hospital here In Bangkok.

Where are you located? Need to know, for time zone reasons.

Note that pyswf hasn't been updated for quite a while, so pyswf may fail on SWF versions 11 or higher.

Is there anyway we can do something about that? Or is there another python module that's newer?

John


Reply to this email directly or view it on GitHub.

oh, now i see that tim is the author of pyswf. :)
so tim is saying that his pyswf doesn't handle more recent swf versions. hmm.
well, my comment on using a newer parser still holds.
i am looking at swftools. i installed it ok, but i don't see how to use it. it seems there is a connection between pyswf and swftools? swftools seems to think so, but there is no mention of swftools in the pyswf github readme.

On Jun 26, 2014, at 7:39 AM, John Draper jdcrunchman@gmail.com wrote:

Good question. This SWF file came from the Thailand Yellow Pages CD, and we wanted to be able to extract text data from it.

Sent from my iPad

On Jun 26, 2014, at 8:12 PM, timknip notifications@github.com wrote:

You didn't attach the file :)

It seems your SWF contains an invalid fillStyle 0x36...
Could be that recent versions of Flash introduced a new fillStyle.
What Flash version did you use to create this SWF?

Is there anyway to modify the python code to ignore this full style.
A possible workaround would be to save your movie as an older version like 10.

It's not really a movie, it's a static SWF file. By the way, I delegated Bob Ackerman to take over this project, he was CCed in this message, you should work with him. I had to detach myself from this project due to health reasons. Back pain so intense, I had to go to hospital here In Bangkok.

Where are you located? Need to know, for time zone reasons.

Note that pyswf hasn't been updated for quite a while, so pyswf may fail on SWF versions 11 or higher.

Is there anyway we can do something about that? Or is there another python module that's newer?

John


Reply to this email directly or view it on GitHub.

John,

It would really help if you send me the SWF so i can try provide you with a fix (Its not attached in the comment you posted earlier).

Please send it to tim at floorplanner dot com.

i see that claus' parser is not a drop-in; pyswf is a translation into python of the parser code.
so the question is, can tim translate the most recent code from claus or tell us how to get around the 'fill' exception.

On Jun 26, 2014, at 10:47 AM, John Draper jdcrunchman@gmail.com wrote:

Ben, Bob writes this...

---------- Forwarded message ----------
From: ackerman dudley rdacker@comcast.net
Date: Thu, Jun 26, 2014 at 9:18 AM
Subject: Re: [pyswf] Print SWF(file) not working. (#16)
To: John Draper jdcrunchman@gmail.com
Cc: timknip/pyswf reply@reply.github.com

interesting that there is a fill style in a supposedly pure text file. maybe the font is included in the text in which case it won't be a simple matter of exporting some unicode text. is there a standard thai alphabet in unicode?

Crunch: where can we get the Thai alphabet in Unicode.

perhaps build the module without throwing an exception on invalid style? source is on github.
interesting that it says the readme was updated 1 month ago, also, the parser it is based on was updated 2 months ago, but not pyswf. so, perhaps, we can drop in the newer parser into pyswf.
is tim interested in doing this project or is he just a helpful resource? would we collaborate?

If possible, Yes Bob... lets see of you can collaborate with timKnip and nail this sucka...

Crunch

On Jun 26, 2014, at 7:39 AM, John Draper jdcrunchman@gmail.com wrote:

Good question. This SWF file came from the Thailand Yellow Pages CD, and we wanted to be able to extract text data from it.

Sent from my iPad

On Jun 26, 2014, at 8:12 PM, timknip notifications@github.com wrote:

You didn't attach the file :)

It seems your SWF contains an invalid fillStyle 0x36...
Could be that recent versions of Flash introduced a new fillStyle.
What Flash version did you use to create this SWF?

Is there anyway to modify the python code to ignore this full style.
A possible workaround would be to save your movie as an older version like 10.

It's not really a movie, it's a static SWF file. By the way, I delegated Bob Ackerman to take over this project, he was CCed in this message, you should work with him. I had to detach myself from this project due to health reasons. Back pain so intense, I had to go to hospital here In Bangkok.

Where are you located? Need to know, for time zone reasons.

Note that pyswf hasn't been updated for quite a while, so pyswf may fail on SWF versions 11 or higher.

Is there anyway we can do something about that? Or is there another python module that's newer?

John


Reply to this email directly or view it on GitHub.

Again. I need the SWF to debug the issue. Please attach it or mail it to me.

I need the file to reproduce the issue.

Ok, those other files I sent were aliases. So are useless to you guys.
So, I've attached a real swf file to this message, and want to call
your attention to this link.

http://wwwimages.adobe.com/www.adobe.com/content/dam/Adobe/en/devnet/swf/pdf/swf-file-format-spec.pdf

This is for reference only, but using this, and a Hex File editor, I
found NO CORRELATION to any of the data as described in this link.

john

On Thu, Jun 26, 2014 at 10:03 AM, ackerman dudley rdacker@comcast.net
wrote:

oh, now i see that tim is the author of pyswf. :)
so tim is saying that his pyswf doesn't handle more recent swf versions.
hmm.
well, my comment on using a newer parser still holds.
i am looking at swftools. i installed it ok, but i don't see how to use
it. it seems there is a connection between pyswf and swftools? swftools
seems to think so, but there is no mention of swftools in the pyswf github
readme.

On Jun 26, 2014, at 7:39 AM, John Draper jdcrunchman@gmail.com wrote:

Good question. This SWF file came from the Thailand Yellow Pages CD,
and we wanted to be able to extract text data from it.

Sent from my iPad

On Jun 26, 2014, at 8:12 PM, timknip notifications@github.com wrote:

You didn't attach the file :)

It seems your SWF contains an invalid fillStyle 0x36...
Could be that recent versions of Flash introduced a new fillStyle.
What Flash version did you use to create this SWF?

Is there anyway to modify the python code to ignore this full style.

A possible workaround would be to save your movie as an older version like
10.

It's not really a movie, it's a static SWF file. By the way, I
delegated Bob Ackerman to take over this project, he was CCed in this
message, you should work with him. I had to detach myself from this
project due to health reasons. Back pain so intense, I had to go to
hospital here In Bangkok.

Where are you located? Need to know, for time zone reasons.

Note that pyswf hasn't been updated for quite a while, so pyswf may fail
on SWF versions 11 or higher.

Is there anyway we can do something about that? Or is there another
python module that's newer?

John


Reply to this email directly or view it on GitHub
#16 (comment).

I thought I did.

Sent from my iPad

On Jun 27, 2014, at 1:17 AM, timknip notifications@github.com wrote:

Again. I need the SWF to debug the issue. Please attach it or mail it to me.

I need the file to reproduce the issue.


Reply to this email directly or view it on GitHub.

Same issue here, basically I can't get passed of simply printing the SWF structure at "print SWF(File)".
Issues start with:

pyswf/swf/movie.py", line 100, in init
self.parse(self._data)

Any ideas?