tor, 07 okt, 2004, 23:09:02 -0400, skrev Paul Bissex: > On Thu, 7 Oct 2004 08:28:17 +0200, VAN??K Petr <petr.vanek at spordat.cz> > wrote: > > > I did have to comment out line 13, "sys.setappdefaultencoding..." > > > because that function isn't present in the sys module in the default > > > Python 2.3 (or in 2.3.4 installed via Fink for that matter) -- but the > > > script works fine for my purposes without it. > > there should be s.t. like > > http://www.py.cz/Members/SUBZERO/PyQt/Soubory/sitecustomize.py > > in your site-packages/sitecustomize.py > > then should work: > > sys.setappdefaultencoding("utf8") > > Nope, aliasing "sys.setdefaultencoding" to "sys.setappdefaultencoding" > won't do it: > > ~> /usr/bin/python > Python 2.3 (#1, Sep 13 2003, 00:49:11) > [GCC 3.3 20030304 (Apple Computer, Inc. build 1495)] on darwin > Type "help", "copyright", "credits" or "license" for more information. > >>> import sys > >>> dir(sys) > ['__displayhook__', '__doc__', '__excepthook__', '__name__', > '__stderr__', '__stdin__', '__stdout__', '_getframe', 'api_version', > 'argv', 'builtin_module_names', 'byteorder', 'call_tracing', > 'callstats', 'copyright', 'displayhook', 'exc_clear', 'exc_info', > 'exc_type', 'excepthook', 'exec_prefix', 'executable', 'exit', > 'getcheckinterval', 'getdefaultencoding', 'getdlopenflags', > 'getfilesystemencoding', 'getrecursionlimit', 'getrefcount', > 'hexversion', 'maxint', 'maxunicode', 'meta_path', 'modules', 'path', > 'path_hooks', 'path_importer_cache', 'platform', 'prefix', 'ps1', > 'ps2', 'setcheckinterval', 'setdlopenflags', 'setprofile', > 'setrecursionlimit', 'settrace', 'stderr', 'stdin', 'stdout', > 'version', 'version_info', 'warnoptions'] > >>> > > No "set*" functions there at all. Result from Python 2.3.4 via Fink is > identical. > > It's possible my setup is nonstandard. Can any other OS X users > confirm or deny? >
I do not think so - I do not use OS X, but it looks the same in Slackware 10.0 (python 2.3.4). The 'sys.setdefaultencoding()' is removed in python2.3/site.py under init of python. So you can _not_ make an alias of it in your code. You need to do it by using python2.3/site-packages/sitecustomize.py Enjoy Morten -- Morten Langlo 8550 Ryomg?rd Denmark