After hearing this app mentioned on numerous podcasts over the years, I decided to download a demo and try to find ways to use it. So seeing several posts around the web on using it to automatically upload files to Amazon S3, I thought I'd try that. I modified (for Python3/boto3) a few of the scripts already out there, and tested it from the CLI. All works as expected.
Then I created a ruleset in Hazel. Since I couldn't figure out how to group triggers, e.g. (this or this or this) AND this, I am using a match rule to match a word-date combo, and an extension of 'pdf'. The matching seems to work, but I can get the script to run (successfully).
Initially I wrote and tested everything in a virtualenv, e.g. Shell = /Users/greybeard/.virtualenvs/hazel/bin/python3, but when that continued to fail, I installed the required modules in the system Python repo and reconfigured the 'shell' to use the default Python3, i.e. /usr/local/bin/python3. That still failed.
After some searching, I found a post on here showing how to enable debug, and another which indicated it might help to include print() statements in the code to track progress. All of which I've done. So the questions:
1) Did Hazel 4 modify the way it interacts with scripts, i.e. should previously posted examples still work?
2) Does it still pass in the path+filename and content type via ARGV?
3) Did H4 modify the way it handles output from a script, i.e. should my print() statements still show up in the log?
4) Is there a way to get it to execute a script from disk, rather than embedded?
Here is the output of the debug log:
- Code: Select all
2016-07-04 09:51:29.466 hazelworker[34578] Amazon-20160615.pdf: Rule Upload Bills to Amazon S3 matched.
2016-07-04 09:51:29.957 hazelworker[34578] [Error] Shell script failed: Error processing shell script on file /Users/swschulz/Downloads/Amazon-20160615.pdf.
2016-07-04 09:51:32.007 hazelworker[34578] Amazon-20160615.pdf: Rule Upload Bills to Amazon S3 matched.
2016-07-04 09:51:32.269 hazelworker[34578] [Error] Shell script failed: Error processing shell script on file /Users/swschulz/Downloads/Amazon-20160615.pdf.
Does this mean the file can't even be compiled since even the introductory print() statements do not display? Is there an extra-verbose option?
I also get these when I move the file back out of Downloads, but these I expect:
- Code: Select all
2016-07-04 09:51:34.380 hazelworker[34578] DEBUG: Skipped /Users/swschulz/Downloads/Amazon-20160615.pdf. File/folder not part of change set/file event.
path = "/Users/swschulz/Downloads/Amazon-20160615.pdf";
2016-07-04 09:54:48.729 HazelHelper[70375] DEBUG: Error resolving symlinks for path /Users/swschulz/Downloads/Amazon-20160615.pdf:, No such file or directory
path = "<ComNoodlesoft_NoodlePathSet: 0x7fd2f871dc30>\n /Users/swschulz/Downloads/Amazon-20160615.pdf : 0\n";
I can post or link to the script if that would be of any benefit.
Thanks for any assistance!