nrosenstein-c4d / c4d-prototype-converter

A Cinema 4D plugin to convert plugin prototypes to actual Python plugins.
MIT License
26 stars 4 forks source link

Bad Token Error on Conversion #50

Open rfspencer opened 6 years ago

rfspencer commented 6 years ago

OSX 10.13.5 Cinema 4D Studio R19.053 (Build RB224935) C4D Prototype Converter v1.2.0

I get an error when running the script converter, following the tutorial content:

   bad token: type=56, value='\r', context=(", (5, 3))
NiklasRosenstein commented 6 years ago

Hi @rfspencer

I can not reproduce your issue. I need some more information, please include the full console output.

NiklasRosenstein commented 6 years ago

If possible, it would also help if you uploaded the script you are trying to convert. If you do, please do not paste the script code into the GitHub comment but instead add the file as an attachment. You can also email the file to me if you don't want to share it publicly. rosensteinniklas@gmail.com

rfspencer commented 6 years ago

Hey @NiklasRosenstein!

Thanks for getting back to me. I've attached the script I was trying to convert; it was just the default "Hello World" script, but I also get this error when converting others, as well.

hello-world.py.zip

I also attached a screen shot, if that helps at all.

screen shot 2018-07-11 at 1 33 51 pm
rfspencer commented 6 years ago

And here's the console output:

Creating /Users/richspencer/Library/Preferences/MAXON/Cinema 4D R19_8DA1506D/plugins/hello-world.pyp
Traceback (most recent call last):
  File "/Users/richspencer/Library/Preferences/MAXON/Cinema 4D R19_8DA1506D/plugins/c4d_prototype_converter-v1.2.0/c4d_prototype_converter/ui/ScriptConverter.py", line 284, in on_create
    cnv.create()
  File "/Users/richspencer/Library/Preferences/MAXON/Cinema 4D R19_8DA1506D/plugins/c4d_prototype_converter-v1.2.0/c4d_prototype_converter/ui/ScriptConverter.py", line 192, in create
    code = refactor.indentation(code, self.indent)
  File "/Users/richspencer/Library/Preferences/MAXON/Cinema 4D R19_8DA1506D/plugins/c4d_prototype_converter-v1.2.0/c4d_prototype_converter/refactor.py", line 371, in indentation
    return str(refactor_string([fixer], code))
  File "/Users/richspencer/Library/Preferences/MAXON/Cinema 4D R19_8DA1506D/plugins/c4d_prototype_converter-v1.2.0/c4d_prototype_converter/refactor.py", line 60, in refactor_string
    return rt.refactor_string(code, filename)
  File "/Applications/MAXON/Cinema 4D R19/resource/modules/python/Python.osx.framework/lib/python2.7/lib2to3/refactor.py", line 380, in refactor_string
    name, err.__class__.__name__, err)
  File "/Applications/MAXON/Cinema 4D R19/resource/modules/python/Python.osx.framework/lib/python2.7/lib2to3/refactor.py", line 377, in refactor_string
    tree = self.driver.parse_string(data)
  File "/Applications/MAXON/Cinema 4D R19/resource/modules/python/Python.osx.framework/lib/python2.7/lib2to3/pgen2/driver.py", line 106, in parse_string
    return self.parse_tokens(tokens, debug)
  File "/Applications/MAXON/Cinema 4D R19/resource/modules/python/Python.osx.framework/lib/python2.7/lib2to3/pgen2/driver.py", line 71, in parse_tokens
    if p.addtoken(type, value, (prefix, start)):
  File "/Applications/MAXON/Cinema 4D R19/resource/modules/python/Python.osx.framework/lib/python2.7/lib2to3/pgen2/parse.py", line 116, in addtoken
    ilabel = self.classify(type, value, context)
  File "/Applications/MAXON/Cinema 4D R19/resource/modules/python/Python.osx.framework/lib/python2.7/lib2to3/pgen2/parse.py", line 172, in classify
    raise ParseError("bad token", type, value, context)
ParseError: bad token: type=56, value='\r', context=('', (4, 3))
NiklasRosenstein commented 6 years ago

Hi @rfspencer thanks for the all the info you provided.

I'm trying hard but I just can not reproduce the error. :-(

What is weird is that it says in the error message line 4 column 3. But line 4 in your Script is empty and thus has no column 3.

Could you please try it with all of these 3 scripts for me and see if the error persists for any or all of them?

test-scripts.zip

jochemdk013 commented 5 years ago

Hi Niklas,

Same problem over here (with different numbers...). This is of course not my tag plugin, but no matter what I test, I always get the same error. (R19 mac os 10.12).

Hope there's a solution, tia, Jochem

screen shot 2019-01-03 at 14 27 45 screen shot 2019-01-03 at 14 28 15
jochemdk013 commented 5 years ago

Just to add to the above... I just tested your V1.2.0 on R20 & I get the same message - fyi

jochemdk013 commented 5 years ago

OK... one more addition. Just tested the script & prototype converter on Windows10 R19, without R20 installed and it worked fine :). Can it be and issue with both having R19 & 20 installed? Thx, Jochem