Photoshop engine export_as_jpeg broken?


I am trying to use Photoshop’s engine.export_as_jpeg() to create a jpeg of the active document to upload as an attachment for a Note.

It seems broken when trying to set the jpg quality.

#403 jpeg_options.quality = quality

Running a simple example in the Photoshop Shotgun Python Console…

jpeg_pub_path = ‘/Users/danieleaton/Desktop/PIPE_SamADev_Test_Ds_v02.jpg’
jpeg_file = engine.adobe.File(jpeg_pub_path)
jpeg_options = engine.adobe.JPEGSaveOptions
jpeg_options.quality = 12

Should I expect this to work?

1 Like

Hmm not sure whats going on. I can reproduce the same thing here if I extract the code out into the python console like you did.

Yet calling engine.export_as_jpeg() works fine and generates a file, I assume it does for you as well?

I even copied the whole export_as_jpeg method into the python console and provided the engine to the self var and that threw the same error.

I think I’ll need to defer to an engineer, however, they are on vacation at the moment so I won’t hear back for a while.


1 Like

No. It does not work. It fails with the same error I get in the console. That what let me here.

If I comment out that line it works. I’m using CC2019. The errors looks like a RPC communication problems between Python and JS?


1 Like

Hmm that is very odd, I can run the engine.export_as_jpeg() without error.
OK, thanks for confirming.


If I copy the entire export_as_jpeg() method to my script it still fails with the same error.

py Showing dialog: Add Note To Version
py Heartbeat restarted.
py _on_add_note_btn_clicked
py Traceback (most recent call last):
py File “/Volumes/Droid/PIPE/Shotgun/PipelineConfigurations/PIPE/Toolkit/install/app_store/tk-photoshopcc-addnote/v0.0.1/python/tk_photoshopcc_addnote/”, line 167, in _on_add_note_btn_clicked
py note)
py File “/Volumes/Droid/PIPE/Shotgun/PipelineConfigurations/PIPE/Toolkit/install/app_store/tk-photoshopcc-addnote/v0.0.1/python/tk_photoshopcc_addnote/”, line 292, in _add_note_to_version
py jpeg_export_path = self._export_as_jpeg(output_path=attachment_path)
py File “/Volumes/Droid/PIPE/Shotgun/PipelineConfigurations/PIPE/Toolkit/install/app_store/tk-photoshopcc-addnote/v0.0.1/python/tk_photoshopcc_addnote/”, line 426, in _export_as_jpeg
py jpeg_options.quality = quality
py File “/Volumes/Droid/PIPE/Shotgun/PipelineConfigurations/PIPE/Toolkit/install/app_store/tk-framework-adobe/v1.0.3/python/tk_framework_adobe/rpc/”, line 278, in setattr
py remote_names =[“properties”] +[“methods”].keys()
py KeyError: ‘properties’

If I copy the entire method into the Python Console I get the same errors.

jpeg_options = adobe.JPEGSaveOptions fails…
jpeg_options = adobe.JPEGSaveOptions() works…

I copied the method to my script, updated the code and it seem to be working correctly now.