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

Replace ast.literal_eval with json.loads for creator and publish attributes to avoid crashes on Unreal #91

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

moonyuet
Copy link
Member

@moonyuet moonyuet commented Sep 12, 2024

Changelog Description

Ported from ynput/OpenPype#6318

Additional info

n/a

Testing notes:

  1. Ayon -> Publish
  2. Create Instance
  3. Turn on/off Instance, or turn on/off setting
  4. Save Instance
  5. Should be worked as expected

Copy link
Member

@LiborBatek LiborBatek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Each time I open Publisher containing some publish instance(s) it gives me error and no publish instances shown in the UI:

Traceback (most recent call last):
  File "C:\Work\REPO\ayon-core\client\ayon_core\pipeline\create\context.py", line 1020, in reset_instances
    creator.collect_instances()
  File "c:\Work\REPO\ayon-unreal\client\ayon_unreal\api\plugin.py", line 177, in collect_instances
    return self._default_collect_instances()
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "c:\Work\REPO\ayon-unreal\client\ayon_unreal\api\plugin.py", line 83, in _default_collect_instances
    instance['publish_attributes'] = json.loads(
                                     ^^^^^^^^^^^
  File "c:\Program Files\Epic Games\UE_5.4\Engine\Binaries\ThirdParty\Python3\Win64\Lib\json\__init__.py", line 346, in loads
    return _default_decoder.decode(s)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "c:\Program Files\Epic Games\UE_5.4\Engine\Binaries\ThirdParty\Python3\Win64\Lib\json\decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "c:\Program Files\Epic Games\UE_5.4\Engine\Binaries\ThirdParty\Python3\Win64\Lib\json\decoder.py", line 353, in raw_decode
    obj, end = self.scan_once(s, idx)
               ^^^^^^^^^^^^^^^^^^^^^^
json.decoder.JSONDecodeError: Expecting property name enclosed in double quotes: line 1 column 2 (char 1)

@moonyuet
Copy link
Member Author

moonyuet commented Sep 23, 2024

@LiborBatek I tested again in my side, strangely it works for create_attributes but not publish_attributes. Probably we need to ask the contributor for more info to see why ast.literal_eval would crash their unreal.
@ccaillot can you test in the latest develop in Ayon to see if the issue still exists?

@mkolar mkolar assigned moonyuet and unassigned LiborBatek Oct 1, 2024
@moonyuet moonyuet added the type: enhancement Improvement of existing functionality or minor addition label Oct 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: enhancement Improvement of existing functionality or minor addition
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants