5 Replies Latest reply on Feb 2, 2018 9:17 AM by gregmoudy

    Python COM ports and CC 19.0

    Erik Spellerberg Level 1

      I have program written with Python 2 that runs externally, which tells Photoshop to save out .dds files. In previous versions of PS this would work fine, but since the 19 update the process often gets interrupted at various stages. Sometimes the export can run to completion, other times it stops and I get an error log message like:

       

      Traceback (most recent call last):
        File "main.py", line 690, in clicked_export
        File "exporter.pyc", line 212, in export
        File "comtypes\client\lazybind.pyc", line 168, in __getattr__
        File "comtypes\automation.pyc", line 729, in _invoke
      _ctypes.COMError: (-2147417846, 'The message filter indicated that the application is busy.', (None, None, None, 0, None))
      

       

      Edit: It seems like I might be able to get around this actually by implementing sleep, but I have had to put this in three different locations so far and it's kinda like playing Whack-A-Mole because the error can show up anywhere depending on when Photoshop feels like being "busy".

       

      SAVING = True
      while SAVING:
        try:
          self.save_as_dds(file_path, group)
          SAVING = False
        except comtypes.COMError as e:
          print e
          time.sleep(0.5)
      
        • 1. Re: Python COM ports and CC 19.0
          Tom Ruark Adobe Employee

          Is this machine dedicated to your external app? Meaning no actual user could be using Ps at the same time? Are these happening during startup of the app? What else is your external app doing with Photoshop besides saving the dds?

          • 2. Re: Python COM ports and CC 19.0
            Erik Spellerberg Level 1

            The machine is not dedicated to this no, we have Maya and other resource heavy programs running along side Photoshop.

            It's a texture exporter with a GUI component also that lets you set up which layer groups to export with different settings. (Kind of like how Quixel works) Storing and reading export settings in fileInfo never causes problems.. it's only giving up when actually performing layer actions, saving the file or, undoing resize commands. So lot's of people using it and they all crash st different lines of code and different times of the day. But it's pretty much just the "Application is busy" error. As mentioned, was not an issue in earlier versions of Photoshop

            • 3. Re: Python COM ports and CC 19.0
              Tom Ruark Adobe Employee

              When you say "crash" you mean that your external program quits with the error or Photoshop is crashing? And there is no dialog up in Photoshop and it appears to be running ok when this occurs? If you just try it again on the failure will it perform whatever you tried? A try then wait then try again kind of operation? You have the latest 19 installed?

              • 4. Re: Python COM ports and CC 19.0
                Erik Spellerberg Level 1

                Ah yes, sorry, it is the external program that is crashing.

                • 5. Re: Python COM ports and CC 19.0
                  gregmoudy

                  We've been seeing these issues as well ever since upgrading to Photoshop CC 2018. We have a number of Python tools that communicate over COM and we keep getting errors like this:

                   

                  pywintypes.com_error: (-2147417846, 'The message filter indicated that the application is busy.', None, None)