Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SyntaxError: invalid syntax #88

Open
nyov opened this issue Oct 11, 2019 · 2 comments
Open

SyntaxError: invalid syntax #88

nyov opened this issue Oct 11, 2019 · 2 comments

Comments

@nyov
Copy link

nyov commented Oct 11, 2019

Fails to work in python2

$ unityextract sharedassets0.assets.resS
Traceback (most recent call last):
  File "/home/nyov/.local/bin/unityextract", line 8, in <module>
    from unitypack.asset import Asset
  File "/home/nyov/.local/lib/python2.7/site-packages/unitypack/asset.py", line 7, in <module>
    from .object import ObjectInfo
  File "/home/nyov/.local/lib/python2.7/site-packages/unitypack/object.py", line 4, in <module>
    from .type import TypeMetadata, TypeTree
  File "/home/nyov/.local/lib/python2.7/site-packages/unitypack/type.py", line 4, in <module>
    from .utils import BinaryReader
  File "/home/nyov/.local/lib/python2.7/site-packages/unitypack/utils.py", line 16
    def extract_audioclip_samples(d) -> dict:
                                     ^
SyntaxError: invalid syntax

Pip installed unitypack-0.6.1.

Is it python3? bin/unityextract has interpreter shebang "env python", not python3. But also fails to work in python3 for a different reason.

@nyov
Copy link
Author

nyov commented Oct 11, 2019

Just installed everything with deps from git, for python3.
Now it works... a tiny bit.

Errors:

$ unityextract sharedassets0.assets.resS
Traceback (most recent call last):
  File "/home/nyov/.local/bin/unityextract", line 159, in <module>
    main()
  File "/home/nyov/.local/bin/unityextract", line 155, in main
    exit(app.run())
  File "/home/nyov/.local/bin/unityextract", line 54, in run
    bundle = unitypack.load(f)
  File "/home/nyov/.local/lib/python3.7/site-packages/unitypack/__init__.py", line 12, in load
    return env.load(file)
  File "/home/nyov/.local/lib/python3.7/site-packages/unitypack/environment.py", line 27, in load
    ret.load(file)
  File "/home/nyov/.local/lib/python3.7/site-packages/unitypack/assetbundle.py", line 40, in load
    raise NotImplementedError("File does not start with b'Unity': %r" % self.path)
NotImplementedError: File does not start with b'Unity': 'sharedassets0.assets.resS'
$ unityextract sharedassets0.assets
WARNING:root:-19 absent from structs.dat
WARNING:root:-23 absent from structs.dat
WARNING:root:-2 absent from structs.dat
WARNING:root:-37 absent from structs.dat
WARNING:root:-40 absent from structs.dat
WARNING:root:-39 absent from structs.dat
WARNING:root:-35 absent from structs.dat
WARNING:root:-36 absent from structs.dat
WARNING:root:-3 absent from structs.dat
WARNING:root:-26 absent from structs.dat
WARNING:root:-22 absent from structs.dat
WARNING:root:-20 absent from structs.dat
WARNING:root:-21 absent from structs.dat
WARNING:root:-9 absent from structs.dat
WARNING:root:-13 absent from structs.dat
WARNING:root:-14 absent from structs.dat
WARNING:root:-16 absent from structs.dat
WARNING:root:-27 absent from structs.dat
WARNING:root:-11 absent from structs.dat
WARNING:root:-28 absent from structs.dat
WARNING:root:-7 absent from structs.dat
WARNING:root:-15 absent from structs.dat
WARNING:root:-24 absent from structs.dat
WARNING:root:-8 absent from structs.dat
WARNING:root:-30 absent from structs.dat
WARNING:root:-25 absent from structs.dat
WARNING:root:-10 absent from structs.dat
WARNING:root:-5 absent from structs.dat
WARNING:root:-6 absent from structs.dat
WARNING:root:-4 absent from structs.dat
WARNING:root:-38 absent from structs.dat
WARNING:root:-18 absent from structs.dat
WARNING:root:-29 absent from structs.dat
WARNING:root:-31 absent from structs.dat
WARNING:root:-33 absent from structs.dat
WARNING:root:-12 absent from structs.dat
WARNING:root:-32 absent from structs.dat
WARNING:root:-34 absent from structs.dat
WARNING:root:-17 absent from structs.dat
Traceback (most recent call last):
  File "/home/nyov/.local/bin/unityextract", line 159, in <module>
    main()
  File "/home/nyov/.local/bin/unityextract", line 155, in main
    exit(app.run())
  File "/home/nyov/.local/bin/unityextract", line 50, in run
    self.handle_asset(asset)
  File "/home/nyov/.local/bin/unityextract", line 83, in handle_asset
    if obj.type not in self.handle_formats:
  File "/home/nyov/.local/lib/python3.7/site-packages/unitypack/object.py", line 30, in type
    script = self.read()["m_Script"]
  File "/home/nyov/.local/lib/python3.7/site-packages/unitypack/object.py", line 84, in read
    return self.read_value(self.type_tree, BinaryReader(BytesIO(object_buf)))
  File "/home/nyov/.local/lib/python3.7/site-packages/unitypack/object.py", line 51, in type_tree
    return TypeMetadata.default(self.asset).type_trees[self.class_id]
KeyError: -19

@loeffel-io
Copy link

belongs to #100

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants