• Content count

  • Joined

  • Last visited

  1. @clenden I'd suggest to drill into the cause of your problem by debugging intermediary results with either one of the two methods: print statements (only works on the command line) writing to a temporary file (see above how to do that) The most likely cause I can think of is that the places.sqlite you are scanning is not the one associated to the Firefox profile you are actually using. What FF version are you on, btw?
  2. I'd suggest to use a fixed path like ~/Library/Application Support/Alfred2/Workflow Data/Python/python to point to the Python interpreter of your choice. This can be as simple as a softlink. And I would recommend to everyone to use a virtualenv install which is standard and lightweight. No need to install another Python, just re-use whatever Python you are using (system, MacPorts, brew, ...).
  3. The query was implemented such that it matches any string where the letters m-a-m-e appear in this order. I now changed this to words (separated by space). I pushed the new package to github. Feel free to give it a test drive.
  4. Please replace the icon method as shown below. This should catch your error. Please let me know if that helps; I will commit that patch to git, then. def icon(db, faviconid): if not faviconid: return data = db.execute(u'select data from moz_favicons where id=%d' % faviconid).fetchone() if not data: return icon = os.path.join(_CACHE, 'icon-%d.png' % faviconid) if (not os.path.exists(icon)) or ((time.time() - os.path.getmtime(icon)) > _CACHE_EXPIRY): open(icon, 'wb').write(data[0]) return icon
  5. Would you please temporarily replace the last block by the code below (the second and third lines have been inserted) and check /tmp/alfred.txt whether your places.sqlite file is identified correctly and exists? (profile, query) = alfred.args() import os open('/tmp/alfred.txt', 'w').write('profile=%s\nplaces=%s\nexists=%s' % (profile, places(profile), os.access(places(profile), os.R_OK))) db = sqlite3.connect(places(profile)) alfred.write(alfred.xml(results(db, query), maxresults=_MAX_RESULTS))
  6. Mike, sorry for answering half a year later, but this forum's amazing activity in the birth phase of Alfred 2 workflows was just too much for me to follow, so I kind of pulled the plug. I'm on Mountain Lion too (10.8.5), and the workflow still works perfectly for me on FF 24. Are other Python workflows functioning? Where is your places.sqlite? Cheers, Jan
  7. Thanks for the suggestion. I'll look into that when I find the time (which could take a couple of weeks). EDIT I just uploaded a modified version which should work for both SIP addresses and normal phone numbers. It replaces a leading + in phone numbers by the country prefix. It is preconfigured to the most common (pretty much everyone but U.S.) setting 00 and can be changed in the bash script.
  8. Please let me know what doesn't work that great with, and I'l see what I can do for you.
  9. I suggest to introduce a "streaming" mode which sets up the communication Alfred <-> subprocess via stdin and stdout of the subprocess. It would be optimal if the encoding was specified explicitly, I propose normalized UTF-8 (not Mac UTF-8). Since the stdout route subprocess -(stdout)-> Alfred is already there, this would symmetrize the communication.
  10. Thanks for the feature request. Not quite sure whether it's really possible to pass every conceivable string as a command-line parameter. By "streaming" I mean that Alfred could feed {query} on the stdin of the subprocess; streaming via stdout is the way the communication from the subprocess into Alfred is set up already. I'll maybe add the streaming part as an alternative suggestion to your feature request. In Python, the communication on behalf on the subprocess would look as follows: query = Up to decoding and normalizing the binary stream (which could then even be encoded as properly normalized UTF-8), that would be the whole story. Clean and easy, no escaping needed at all.
  11. This one's for you:
  12. @johnjddoe: I can confirm that 2n-1 and 2n backslashes (n>0) within double quotes arrive in Python as n backslashes. Annoying indeed. I think we should file an issue to request a proper unescaping (if possible at all). Maybe the cleanest way out is to offer a streaming mode where the script harvests UTF-8 (either Mac style or normalized) on stdin and yields UTF-8 on stdout.
  13. I escape backlashes in Alfred and unescape them in python-alfred, and that approach also treats backslashes correctly. Which characters or character sequences are left which aren't treated correctly?
  14. The encoding is UTF-8 in a funny variant which Mac OS X uses and which encodes, e.g., ü as ¨ + u. I solved this problem by first decoding to UTF-8, followed by a unicode normalizing operation (NFC, cf., which in Python reads: def decode(s): return unicodedata.normalize('NFC', s.decode('utf-8')) You'll have to dig out for yourself how this works in PHP. Never looked into this language because it hurts my eye with its perlish appearance, but this might be a place to begin searching ...
  15. Sure: Just use a single quote '. That doesn't even trigger the Python script without double quotes around {query}. Disagreed. I think the best practice is to take care that any string arrives in Python just as the user entered it in Alfred (straight from the horse's mouth). If you've got that worked out, you wouldn't want to change that any more. Of course, you're free to interpret that string at will and as it suits your specific application.