lifelike / countersheetsextension

Inkscape extension for the layout of sheets of cards, tiles, or counters for boardgames.
Other
235 stars 27 forks source link

AttributeError: 'str' object has no attribute 'decode' #63

Closed ArnyminerZ closed 4 years ago

ArnyminerZ commented 4 years ago

I have just installed the extension, and while trying to run the cards example, i get this error:

Traceback (most recent call last):
  File "countersheet.py", line 2153, in <module>
    effect.run()
  File "C:\Program Files\Inkscape\share\inkscape\extensions\inkex\base.py", line 123, in run
    self.save_raw(self.effect())
  File "countersheet.py", line 1334, in effect
    self.geometry = self.queryAll(os.path.abspath(sys.argv[-1]))
  File "countersheet.py", line 959, in queryAll
    geometry[element_id.decode(sys.getfilesystemencoding())] = r
AttributeError: 'str' object has no attribute 'decode'

Any ideas on what can be wrong?

I am loading up the cards.svg file, and in the Create Countersheet Wizard I am leaving all parameters as default except the Data File input, in which I am putting the path "repo\examples\cards.csv" and in Image Path "repo\examples".

I am using Inkscape 1.0 (4035a4fb49, 2020-05-01) with Python 3.8.1 on Windows 10 Pro version 2004 (19041.572).

I leave here the generated log file:

svg path: C:\*\AppData\Local\Temp
bleed enabled: False
one-sided sheets: False
svg.width: 816.0
svg.height: 1056.0
svg.unit: px
full registration marks: False
registration marks length: 56.692913
outline distance: 37.795276
spacing: 0.000000
back horizontal offset: 0.000000
back vertical offset: 0.000000
viewBox: 0 0 765 990
SVG widthxheight: 8.5inx11in
SVG size in user-units: 816.000000x1056.000000
queryAll for: C:\*\AppData\Local\Temp\ink_ext_XXXXXX.svg1M0XS0
svg2,-884.037,-68.256,600.877,702.595
 svg2 -828.784688,-63.990000 563.322187x658.682813
fmorato commented 4 years ago

You can fix it manually by editing countersheet.py line 959 and replace it with:

geometry[element_id] = r

You should remove line 960.

I am actually wondering if the author ran the script at all after the last commit. It shouldn't work as is.

ArnyminerZ commented 4 years ago

Ok, after doing that, no error is shown, but now Inkscape gets frozen once I click the Apply button.

I append the log file in case it's useful (logfile.log). This is what I get when trying to apply the templates/prototype_cards.svg with CSV templates/prototype_cards_all.csv and Images dir templates/.

Thanks for the help

fmorato commented 4 years ago

I have no idea why. The logs look normal. Do you have inkscape 1.0+?

I installed the extension today for the first time as well. After these changes it worked more or less ok. Still learning how to use it.

So open one of the examples.svg and in the extention window, select the proper example.csv file and press apply. I did that and saw the expected outcome.

26 Oct 2020 19:11:22 ArnyminerZ notifications@github.com:

Ok, after doing that, no error is shown, but now Inkscape gets frozen once I click the Apply button.

I append the log file in case it's useful (logfile.log[https://github.com/lifelike/countersheetsextension/files/5440282/logfile.log]). This is what I get when trying to apply the templates/prototype_cards.svg with CSV templates/prototype_cards_all.csv and Images dir templates/.

Thanks for the help

— You are receiving this because you commented. Reply to this email directly, view it on GitHub[https://github.com/lifelike/countersheetsextension/issues/63#issuecomment-716695130], or unsubscribe[https://github.com/notifications/unsubscribe-auth/ADA26Y4LJHTTMNS5V7DRKOLSMWUTTANCNFSM4S6GWMDQ]. [https://github.com/notifications/beacon/ADA26Y4JGWNCO5GNY3D26WTSMWUTTA5CNFSM4S6GWMD2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOFK36MWQ.gif]

lifelike commented 4 years ago

The issue (string error) was fixed over a week ago... but then I forgot to push that to github, because I was planning on doing some more testing first. But I pushed it now anyway, because even without more tests at least it works much better (i.e. it does not immediately crash like before). There were some other fix(es) as well, but not sure if that has anything to do with the other problem discussed in comments above.

lifelike commented 4 years ago

I tried templates/prototype_cards_all.csv (in Inkscape 1.0.1, latest master version of the extension) and see no errors.

Will close this now, as the original string error issue is fixed, but please report again as its own issue if that template is still hanging.