Page 1 of 1

python script fails in hazel, works in terminal

PostPosted: Tue May 01, 2012 4:40 pm
by cliffw
Hi there. I use Hazel (among many other things) to copy the public URL for files I add to my Dropbox public folder. It watches that folder and just runs a simple python script. Been using the same script forever. In the last few days it seems to have stopped working. Using 3.0.5.

Here's the error being logged:
Code: Select all
5/1/12 1:31:30.225 PM [0x0-0x16d16d].com.noodlesoft.HazelHelper: Python error: <stdin> is a directory, cannot continue


And here's the script (saved as it's own file—not embedded (although I tried that too to same effect)):
Code: Select all
#!/usr/bin/python

import sys
import urllib
import syslog
import os

syslog.openlog("system")
file = sys.argv[1]
encFile = urllib.quote(file)
encFile = os.path.basename(encFile)
url = "http://dl.dropbox.com/u/obscured/" + encFile
cmd = "echo %s | pbcopy" % url
os.system(cmd)

cmd = '/usr/local/bin/growlnotify -n "script" -a "Terminal.app" -m "Dropbox URL copied for\n%s"' % os.path.basename(file)
syslog.syslog(syslog.LOG_INFO, cmd)
os.system(cmd)

syslog.closelog()




Any ideas?

Re: python script fails in hazel, works in terminal

PostPosted: Thu May 03, 2012 2:39 pm
by Mr_Noodle
There seems to be a oddly random thing that I've been noticing on and off. Can you try reinstalling Hazel? Use the following procedure:

- Quit System Preferences.
- Go to your Library/PreferencePanes folder and throw away Hazel.prefPane
- Download the latest version from the site.
- Move the new Hazel.prefPane to Library/PreferencePanes
- Launch System Preferences and load up Hazel.

If that doesn't work, email me as I may need you to try some test builds.

Re: python script fails in hazel, works in terminal

PostPosted: Fri Dec 28, 2012 4:51 pm
by mpacer
Any update on this? Did reinstalling Hazel work? Do we know the culprit yet?

Re: python script fails in hazel, works in terminal

PostPosted: Wed Jan 02, 2013 2:46 pm
by Mr_Noodle
I don't recall what the outcome was here but if you are having problems, I suggest posting specific details.