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

COMError on doJavaScript #137

Open
wallneradam opened this issue Mar 28, 2022 · 10 comments
Open

COMError on doJavaScript #137

wallneradam opened this issue Mar 28, 2022 · 10 comments

Comments

@wallneradam
Copy link

wallneradam commented Mar 28, 2022

Describe the bug
I'm trying to run javascript with doJavaScript, but i t throws a com error.

To Reproduce
Just run the example: https://loonghao.github.io/photoshop-python-api/examples/#eval-javascript

Desktop (please complete the following information):

  • OS: Windows 10
  • Photoshop-2020
  • Python Version: 3.9.12

Additional context
The traceback:

  Traceback (most recent call last):
  File "F:\Orthogroup\PSAuto\venv\lib\site-packages\comtypes\automation.py", line 791, in Invoke
    self.__com_Invoke(dispid, riid_null, _lcid, _invkind, byref(dp),
_ctypes.COMError: (-2147352567, 'Kivétel történt.', (None, None, None, 0, None))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "F:\Orthogroup\PSAuto\test.py", line 11, in <module>
    app.doJavaScript(jsx)
  File "F:\Orthogroup\PSAuto\venv\lib\site-packages\photoshop\api\application.py", line 396, in doJavaScript
    return self.app.doJavaScript(javascript, Arguments, ExecutionMode)
  File "F:\Orthogroup\PSAuto\venv\lib\site-packages\comtypes\client\dynamic.py", line 121, in __getattr__
    result = self._comobj.Invoke(dispid, _invkind=flags)
  File "F:\Orthogroup\PSAuto\venv\lib\site-packages\comtypes\automation.py", line 799, in Invoke
    raise COMError(hresult, text, details)
_ctypes.COMError: (-2147352567, 'Kivétel történt.', ('Nem megengedett argumentum - 1-es argumentum\n- Hiányzik egy kötelező érték', 'Adobe Photoshop', None, 0, -2147220262))
@loonghao
Copy link
Owner

@wallneradam

Looks like it's because of the character 'Kivétel történt.'

Can you test other text content? just to be sure if it's causing it

@wallneradam
Copy link
Author

Looks like it's because of the character 'Kivétel történt.'

@loonghao It means Exception occurred in Hungarian. It is not my input. I just run the example program. It is a Hungarian machine with Hungarian PS, I can't change language of the system.

@loonghao
Copy link
Owner

loonghao commented Apr 4, 2022

Looks like it's because of the character 'Kivétel történt.'

@loonghao It means Exception occurred in Hungarian. It is not my input. I just run the example program. It is a Hungarian machine with Hungarian PS, I can't change language of the system.

Very strange, I want you to help me test other examples, wondering if none of the other examples work or only this one.

@TsXor
Copy link

TsXor commented Aug 2, 2022

It is often when there is an "error in photoshop-side" in your code that COMError emerges. For example, when you use executeActionGet but the ActionReference you use matches no object, COMError will happen.
I suggest your testing the javascript with ExtendScript Toolkit.

@wallneradam
Copy link
Author

@TsXor No, as you can see from the error message, it is because of system language.

@TsXor
Copy link

TsXor commented Aug 2, 2022

@TsXor No, as you can see from the error message, it is because of system language.

It is just error message. On system with Chinsese language, it will show Exception occurred in Chinese!

@wallneradam
Copy link
Author

@TsXor As I wrote, I tested it with the examples of the project: https://loonghao.github.io/photoshop-python-api/examples/#eval-javascript
So it should be good.

@TsXor
Copy link

TsXor commented Aug 2, 2022

@TsXor As I wrote, I tested it with the examples of the project: https://loonghao.github.io/photoshop-python-api/examples/#eval-javascript So it should be good.

Then we should find where is wrong. Try that js.
js okay -> something wrong with "communication", for example, encoding
js wrong -> some js functions may be deprecated, or the js is not copied properly

@TsXor
Copy link

TsXor commented Aug 2, 2022

Also, did ps alert anything?

@akarcode
Copy link

this is because the 'doJavaScript' should be 'DoJavaScript' with uppercase 'D'.

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

No branches or pull requests

4 participants