paulh-rnd / TabbedBoxMaker

Inkscape tabbed box generator plugin - quickly design complex "finger jointed" boxes
GNU General Public License v2.0
203 stars 47 forks source link

maybe still a bug here - inkscape1.0 - simplestyle #36

Closed nicolasdb closed 4 years ago

nicolasdb commented 4 years ago

I'm on linux Manjaro, inkscape1.0 of course. Python3 is installed. And boxmaker.py is executable

Settings by default image

And I receive this message:

Traceback (most recent call last):
  File "boxmaker.py", line 53, in <module>
    import os,sys,inkex,simplestyle,gettext,math
ImportError: bad magic number in 'simplestyle': b'\x03\xf3\r\n'

How can I help?

paulh-rnd commented 4 years ago

Thanks for the report.

It seems this is related to .pyc file corruption, or version issues when upgrading to Python 3 and not the TabbedBoxMaker extension itself. I've tested this on CentOS 8.2 and it seems to work fine, I haven't tested with Manjaro, but I think you might have luck removing some of the .pyc files as suggested in the following GitHub and SO answers (and there are many others):

https://github.com/Miserlou/Zappa/issues/854 https://github.com/songdejia/EAST/issues/17 https://stackoverflow.com/questions/52477683/importerror-bad-magic-number-in-time-b-x03-xf3-r-n-in-django https://stackoverflow.com/questions/52698854/importerror-bad-magic-number-in-dateparser-b-x03-xf3-r-n

I'd suggest locating your __pycache__ directory and clearing those cache files out (see the answer in the last link above, run this command in the pycache dir). Let me know if that doesn't fix it, and if you can provide any further insights that might help me repro, I'll reopen this issue.

On a side note and maybe related: simplestyle may be deprecated and the extension upgrade guide says to remove dependency listings for simplestyle.py from .inx files, but it doesn't mention anything relating to script files. I'm using it currently and not sure what the alternative might be, so for now it stays :)

nicolasdb commented 4 years ago

Thanks, I'll share what I found here, just in case.

After reading more about it, it is indeed a problem of cache when upgrading from python 2>3. So I enter this command on root directory and the problem is solved. :fireworks: sudo find . -name "*.pyc" -exec rm -f {} \;

note: the command didn't worked on home directory.


I tried on another computer with a recent install of Manjaro20.0. I got this error but It's just about LXML not being installed by default. Easy to fix.

image image

paulh-rnd commented 4 years ago

awesome, thanks for the info @nicolasdb! Good to hear you solved it.