(I hope I put this in the correct section! XD )
I don't want to reveal what specifically I'm working on atm, but at this stage, it's not gotten to anything that will be specific to my program. My issue arises when trying to use PFP to parse the binary files with the blueprint template files (specifically the header files: header.smbph and smbph.bt, as it appears to work correctly for the other pairs of files). I'm not entirely sure, but the issue has to either be with the version of the smbph.bt listed here:
Blueprint File Formats - StarMade Wiki
with the PFP module
OR with the py010parser module that PHP is dependent upon.
I only just installed PFP via pip3 in the command prompt (Windows 10), which in turn installed its dependencies, so it should be completely up-to-date.
I'd like to add I know it isn't my code itself causing the bug because, as stated before, it works correctly for the logic, meta, and SMD3 pairs of files, and they use the same code with the only alteration being variable names (in fact, their code was copied from the head's block of code)
I've linked above to where the smbph.bt template file can be found, and if needed, I could probably point you to where the modules I'm using could be found, if you don't already have them installed.
[doublepost=1496103663,1496103367][/doublepost]I will add that while doing some digging around earlier, in one of the .py files for the py010parser, it had some list of dictionaries called "actions", and the error resulted when the result that was wanted from one of the contained dictionaries simply didn't exist. (this bit of code was found several lines before where the traceback occurred. The dictionary request returned None, and error handling was triggered from an if statement when testing to see if it contained a value or not). Alas, I couldn't find where this list was initialized as, oddly, it appears it should be initialized in the constructor for the parser class this was all a part of, but throwing in some print statements indicated said constructor is never actually run... but the list is most definitely initialized with values somewhere.
I don't want to reveal what specifically I'm working on atm, but at this stage, it's not gotten to anything that will be specific to my program. My issue arises when trying to use PFP to parse the binary files with the blueprint template files (specifically the header files: header.smbph and smbph.bt, as it appears to work correctly for the other pairs of files). I'm not entirely sure, but the issue has to either be with the version of the smbph.bt listed here:
Blueprint File Formats - StarMade Wiki
with the PFP module
OR with the py010parser module that PHP is dependent upon.
I only just installed PFP via pip3 in the command prompt (Windows 10), which in turn installed its dependencies, so it should be completely up-to-date.
Traceback (most recent call last):
File "D:\WindowsData\Users\wizerd\Documents\Starmade\mods and programs\[REDACTED]\WizTech [REDACTED].py", line 178, in <module>
shipFromDict("", files, 0)
File "D:\WindowsData\Users\wizerd\Documents\Starmade\mods and programs\[REDACTED]\WizTech [REDACTED].py", line 107, in shipFromDict
temp = shipFromDict(name+dir+'/', mydict, depth+1)
File "D:\WindowsData\Users\wizerd\Documents\Starmade\mods and programs\[REDACTED]\WizTech [REDACTED].py", line 142, in shipFromDict
ship.attachments[attname] = shipFromDict(attname, mydict, depth+1) # recursively generate attached ships
File "D:\WindowsData\Users\wizerd\Documents\Starmade\mods and programs\[REDACTED]\WizTech [REDACTED].py", line 130, in shipFromDict
ship.head[1] = parse(template_file=TMP_HEAD, data=BytesIO(mydict[elemName])) # this is causing some sorta weird error with pfp...
File "C:\Program Files (hdd)\Python35\lib\site-packages\pfp\__init__.py", line 91, in parse
printf = printf,
File "C:\Program Files (hdd)\Python35\lib\site-packages\pfp\interp.py", line 677, in parse
self._ast = self._parse_string(template, predefines)
File "C:\Program Files (hdd)\Python35\lib\site-packages\pfp\interp.py", line 817, in _parse_string
keep_scopes=predefines
File "C:\Program Files (hdd)\Python35\lib\site-packages\py010parser\__init__.py", line 90, in parse_string
keep_scopes = keep_scopes
File "C:\Program Files (hdd)\Python35\lib\site-packages\py010parser\c_parser.py", line 178, in parse
debug=debuglevel)
File "C:\Program Files (hdd)\Python35\lib\site-packages\py010parser\ply\yacc.py", line 265, in parse
return self.parseopt_notrack(input,lexer,debug,tracking,tokenfunc)
File "C:\Program Files (hdd)\Python35\lib\site-packages\py010parser\ply\yacc.py", line 1048, in parseopt_notrack
tok = self.errorfunc(errtoken)
File "C:\Program Files (hdd)\Python35\lib\site-packages\py010parser\c_parser.py", line 1952, in p_error
column=self.clex.find_tok_column(p)))
File "C:\Program Files (hdd)\Python35\lib\site-packages\py010parser\plyparser.py", line 54, in _parse_error
raise ParseError("%s: %s" % (coord, msg))
py010parser.plyparser.ParseError: <string>:9:16: before: int
File "D:\WindowsData\Users\wizerd\Documents\Starmade\mods and programs\[REDACTED]\WizTech [REDACTED].py", line 178, in <module>
shipFromDict("", files, 0)
File "D:\WindowsData\Users\wizerd\Documents\Starmade\mods and programs\[REDACTED]\WizTech [REDACTED].py", line 107, in shipFromDict
temp = shipFromDict(name+dir+'/', mydict, depth+1)
File "D:\WindowsData\Users\wizerd\Documents\Starmade\mods and programs\[REDACTED]\WizTech [REDACTED].py", line 142, in shipFromDict
ship.attachments[attname] = shipFromDict(attname, mydict, depth+1) # recursively generate attached ships
File "D:\WindowsData\Users\wizerd\Documents\Starmade\mods and programs\[REDACTED]\WizTech [REDACTED].py", line 130, in shipFromDict
ship.head[1] = parse(template_file=TMP_HEAD, data=BytesIO(mydict[elemName])) # this is causing some sorta weird error with pfp...
File "C:\Program Files (hdd)\Python35\lib\site-packages\pfp\__init__.py", line 91, in parse
printf = printf,
File "C:\Program Files (hdd)\Python35\lib\site-packages\pfp\interp.py", line 677, in parse
self._ast = self._parse_string(template, predefines)
File "C:\Program Files (hdd)\Python35\lib\site-packages\pfp\interp.py", line 817, in _parse_string
keep_scopes=predefines
File "C:\Program Files (hdd)\Python35\lib\site-packages\py010parser\__init__.py", line 90, in parse_string
keep_scopes = keep_scopes
File "C:\Program Files (hdd)\Python35\lib\site-packages\py010parser\c_parser.py", line 178, in parse
debug=debuglevel)
File "C:\Program Files (hdd)\Python35\lib\site-packages\py010parser\ply\yacc.py", line 265, in parse
return self.parseopt_notrack(input,lexer,debug,tracking,tokenfunc)
File "C:\Program Files (hdd)\Python35\lib\site-packages\py010parser\ply\yacc.py", line 1048, in parseopt_notrack
tok = self.errorfunc(errtoken)
File "C:\Program Files (hdd)\Python35\lib\site-packages\py010parser\c_parser.py", line 1952, in p_error
column=self.clex.find_tok_column(p)))
File "C:\Program Files (hdd)\Python35\lib\site-packages\py010parser\plyparser.py", line 54, in _parse_error
raise ParseError("%s: %s" % (coord, msg))
py010parser.plyparser.ParseError: <string>:9:16: before: int
I'd like to add I know it isn't my code itself causing the bug because, as stated before, it works correctly for the logic, meta, and SMD3 pairs of files, and they use the same code with the only alteration being variable names (in fact, their code was copied from the head's block of code)
I've linked above to where the smbph.bt template file can be found, and if needed, I could probably point you to where the modules I'm using could be found, if you don't already have them installed.
[doublepost=1496103663,1496103367][/doublepost]I will add that while doing some digging around earlier, in one of the .py files for the py010parser, it had some list of dictionaries called "actions", and the error resulted when the result that was wanted from one of the contained dictionaries simply didn't exist. (this bit of code was found several lines before where the traceback occurred. The dictionary request returned None, and error handling was triggered from an if statement when testing to see if it contained a value or not). Alas, I couldn't find where this list was initialized as, oddly, it appears it should be initialized in the constructor for the parser class this was all a part of, but throwing in some print statements indicated said constructor is never actually run... but the list is most definitely initialized with values somewhere.