These pages about different languages / apis / best practices were mostly jotted down quckily and rarely corrected afterwards.
The languages / apis / best practices may have changed over time (e.g. the facebook api being a prime example), so what was documented as a good way to do something at the time might be outdated when you read it (some pages here are over 15 years old).
Just as a reminder.
Howto for using py2app on MacOsX
Developer notes for how to use it and common installation problems
Py2app, how to use it on macosx
Installation of py2appIt already exist in Snow Leopard and later (not sure about before) , in
So normally no need to install it on Macosx.
If you need to install it:
Download the latest py2app
Install it from source:
To use it on your python script:
Possible problemsAttributeError: 'NoneType' object has no attribute 'get_config_var'
Cant recall the error message, but if it complains about argv emulation when trying to execute the app
Set it to false in setup.py:
Links to relevant websitespy2app, MacPorts, Snow Leopard, and PIL: a match made in Hell
How to make standalone OS X application bundles from PyQt apps using py2app
Usage examples of py2appIncluding extra files (e.g. images)
Edit setup.py to include the extra files in DATA_FILES
Alternatives to py2appPlatypus, "Platypus is a developer tool for the Mac OS X operating system. It creates native Mac OS X applications from interpreted scripts such as shell scripts or Perl, Ruby and Python programs. This is done by wrapping the script in an application bundle along with a native executable binary that runs the script."
Python general notes
installing pgdb with mac ports
Make sure you have the macports pip (and not the default one) sudo port install py27-pip install with pip: pip-2.7 install PyGreSQL If pg_config tool is not available: Make sure the postgres bin is in the path, e.g. export PATH=/usr/local/pgsql91/bin/:$PATH
Timeout when waiting for user input
# Expect the user to type something # if he does not type something within 5 seconds the script complains import sys, signal Timeout = 'Timeout exception.' def timed_out(signo, frame): raise Timeout signal.signal(signal.SIGALRM, timed_out) print "write something! " buf = '' try: signal.alarm(5) buf = sys.stdin.readline() signal.alarm(0) except Timeout: print "\a----Are you still there?" if buf: print "Received: ", buf
Dump a dictionary
(to avoid "too many values to unpack" problem) for field, possible_values in fields.iteritems(): print field, possible_values
Check syntax without executingpython -m py_compile
Convert int to string and vice versa
botoSending/Receiveing msgs to SQS automatically decode/encode base64
More programming related pages