[Pythonmac-SIG] "no codec search functions registered" when /usr/bin/ in PATH

Ivan Kozik ivan@allometra.com
Sun, 22 Dec 2002 19:33:11 -0800


--Apple-Mail-2-30165347
Content-Transfer-Encoding: 7bit
Content-Type: text/plain;
	charset=US-ASCII;
	format=flowed

Hello,

Right now I'm using the Python version built by apple (anyone know 
which one this is?). It almost works great (even executes 
Resources/__main__.py) in my .app bundle, but the problem is that I get 
the error message:
LookupError: no codec search functions registered: can't find encoding
when I open my program with /usr/bin in the $PATH variable.
For example: '/usr/bin/open -a ProgramName' does not work, while 
'PATH="" /usr/bin/open -a ProgramName' does work. Double-clicking in 
the Finder does not work either. I later discovered that this problem 
is not directly related to that "/usr/bin" is in the PATH, but that 
"/usr/bin/python" exists. After I renamed the "python" link to 
"python-bak" in /usr/bin, the program started even when /usr/bin was in 
the $PATH.

I can't distribute it as it is because I am sure many people will have 
a python in /usr/bin. Since this solution *almost* works for me, I 
really wouldn't like to go to something else, but if I have to, I'm ok 
with that. Is there any way I can get PATH="" without a wrapper script 
in my .app bundle?
I have also tried compiling the standard Python distribution with 
--enable-framework --enable-toolbox-glue but when I put it in my 
bundle, it doesn't seem to like the -psn junk the Finder and 'open' 
passes to it:
file | -] [arg] ...
Try `python -h' for more information.
Unknown option: -p

The standard python distribution also seems to ignore the code in 
Python/Mac/.
I have also tried MacPython, but I really didn't like it. It's a rather 
ancient-looking solution for me.

Any help would be appreciated.

Thanks,
Ivan
--Apple-Mail-2-30165347
Content-Transfer-Encoding: 7bit
Content-Type: text/enriched;
	charset=US-ASCII

<fontfamily><param>Arial</param>Hello,


Right now I'm using the Python version built by apple (anyone know
which one this is?). It almost works great (even executes
Resources/__main__.py) in my .app bundle, but the problem is that I
get the error message:

LookupError: no codec search functions registered: can't find encoding

when I open my program with /usr/bin in the $PATH variable.

For example: '/usr/bin/open -a ProgramName' does not work, while
'PATH="" /usr/bin/open -a ProgramName' does work. Double-clicking in
the Finder does not work either. I later discovered that this problem
is not directly related to that "/usr/bin" is in the PATH, but that
"/usr/bin/python" exists. After I renamed the "python" link to
"python-bak" in /usr/bin, the program started even when /usr/bin was
in the $PATH. 


I can't distribute it as it is because I am sure many people will have
a python in /usr/bin. Since this solution *almost* works for me, I
really wouldn't like to go to something else, but if I have to, I'm ok
with that. Is there any way I can get PATH="" without a wrapper script
in my .app bundle?

I have also tried compiling the standard Python distribution with
--enable-framework --enable-toolbox-glue but when I put it in my
bundle, it doesn't seem to like the -psn junk the Finder and 'open'
passes to it:

</fontfamily><fixed>file | -] [arg] ...

Try `python -h' for more information.</fixed><fontfamily><param>Arial</param>

</fontfamily><fixed>Unknown option: -p


The standard python distribution also seems to ignore the code in
Python/Mac/.

I have also tried MacPython, but I really didn't like it. It's a
rather ancient-looking solution for me.


Any help would be appreciated.


Thanks,

Ivan</fixed>
--Apple-Mail-2-30165347--