I rewrote an applescript that sets some custom meta data in python using the pydt3 API. I ran the original non-python applescript via a smart rule, so I attached the new python script to the same smart rule via an intermediary applescript:
on PerformSmartRule(theRecords) do shell script "/Library/Frameworks/Python.framework/Versions/3.12/bin/python3 /Users/samrose/PycharmProjects/set_MetaData/set_MetaData.py" end PerformSmartRule
I confirmed that both smart rules do the same thing when applied on demand. However, the python smart rule sometimes doesn’t trigger on import (I never had this issue with the non-python smart rule). It tends to fail about 50 - 60% of the time when I am importing by downloading a file into the global inbox. Once the file is in the global inbox, I can run the python smart rule on demand and it works fine. If I switch back to the original smart rule using the non-python script and re-download the items, the smart rule triggers and runs the script as expected.
The original smart rule attached to the non-python applescript is set up as:
The python smart rule is set up the same way, though I added On Clipping:
I don’t understand enough to troubleshoot the difference. I tried adding ‘On Downloading’ to the python smart rule, but it didn’t help, and I didn’t need to add On Downloading for the original non-python smart rule to trigger in the same situations.
Any ideas on what might be causing the discrepancy?