Use of __file__ incompatible with py2exe

Running a py2exe of obfsproxy:

$ /cygdrive/c/Python27/python.exe setup_py2exe.py py2exe
$ ./py2exe_bundle/dist/obfsproxy.exe
Traceback (most recent call last):
  File "obfsproxy", line 6, in <module>
NameError: name '__file__' is not defined

It works before the change in a66db465:

$ ./py2exe_bundle/dist/pyobfsproxy.exe
usage: pyobfsproxy.exe [-h] [--log-file LOG_FILE]
                       [--log-min-severity {error,warning,info,debug}]
                       [--no-log] [--no-safe-logging]
                       {managed,obfs2,dummy,obfs3,b64} ...
pyobfsproxy.exe: error: too few arguments

I don't know if this trick used in flashproxy will help:

    if getattr(sys, "frozen", False):
        script_dir = os.path.dirname(sys.executable)
    else:
        script_dir = sys.path[0]