kyamagu / photoshop-connection

Python package to remotely execute ExtendScript in Adobe Photoshop.
https://photoshop-connection.readthedocs.io
MIT License
22 stars 3 forks source link

conn.open_document() doesn't work #5

Open fatihmert opened 4 years ago

fatihmert commented 4 years ago

Hello,

I have been tested succesfully uploaded photoshop file from client to remote server and it is correct file path show to me. But open_document does not work.

My codes

from photoshop import PhotoshopConnection

with PhotoshopConnection(password='123456', host="194.31.59.56") as conn:
    uploadedPath = ""

    with open('test.psd', 'rb') as f:
        uploadedPath = conn.upload(f.read(), suffix='.psd')

    print(uploadedPath)
    conn.open_document(uploadedPath)

Return errors like this;

Reloaded modules: photoshop, photoshop.protocol, photoshop.crypto, photoshop.api
Error: Unknown JavaScript error
Traceback (most recent call last):
  File "C:\_my-mind\_codes\photoshop-connect\photoshop\__init__.py", line 188, in _transaction
    yield txn
  File "C:\_my-mind\_codes\photoshop-connect\photoshop\__init__.py", line 222, in execute
    response = txn.receive(timeout=timeout)
  File "C:\_my-mind\_codes\photoshop-connect\photoshop\__init__.py", line 44, in receive
    raise response
  File "C:\_my-mind\_codes\photoshop-connect\photoshop\__init__.py", line 66, in dispatch
    'Error: %s' % response['body'].decode('utf-8', 'ignore')
RuntimeError: Error: Unknown JavaScript error
C:\Users\ADMINI~1\AppData\Local\Temp\2\tempdata8.tmp.psd
Traceback (most recent call last):

  File "C:\_my-mind\_codes\photoshop-connect\untitled0.py", line 17, in <module>
    conn.open_document(uploadedPath)

  File "C:\_my-mind\_codes\photoshop-connect\photoshop\__init__.py", line 306, in open_document
    return self.execute(self._render('open.js.j2', locals()))

  File "C:\_my-mind\_codes\photoshop-connect\photoshop\__init__.py", line 222, in execute
    response = txn.receive(timeout=timeout)

  File "C:\_my-mind\_codes\photoshop-connect\photoshop\__init__.py", line 44, in receive
    raise response

  File "C:\_my-mind\_codes\photoshop-connect\photoshop\__init__.py", line 66, in dispatch
    'Error: %s' % response['body'].decode('utf-8', 'ignore')

RuntimeError: Error: Unknown JavaScript error

Thank you.

kyamagu commented 4 years ago

Hmm, could be backslash escaping problem. Do you get the same result if you instead use execute like the second example here?