Egg cache problem with mod_python/ez_setup

2006-06-12 Thread Manuzhai
Hello there,

I have this weird problem with a mod_python application.

Recently I installed ElementTree and cElementTree through ez_setup.py, 
even though they were already installed normally (this might not be too 
smart, but I don't think it's related to my actual problem).

I have a web application written on top of mod_python that uses 
cElementTree for several things. After installing cElementTree through 
ez_setup.py, it turns out that I got this Exception on the site:

(most relevant info at the end, obviously, it's quite lengthy)

Mod_python error: PythonHandler equilex

Traceback (most recent call last):

   File /usr/lib/python2.4/site-packages/mod_python/apache.py, line 
287, in HandlerDispatch
 log=debug)

   File /usr/lib/python2.4/site-packages/mod_python/apache.py, line 
464, in import_module
 module = imp.load_module(mname, f, p, d)

   File /var/www/equilex.eu/http/equilex/__init__.py, line 2, in ?
 from equilex.model import Session

   File /var/www/equilex.eu/http/equilex/model/__init__.py, line 4, in ?
 from page import Page

   File /var/www/equilex.eu/http/equilex/model/page.py, line 1, in ?
 from menu import Menu

   File /var/www/equilex.eu/http/equilex/model/menu.py, line 1, in ?
 import cElementTree as et

   File build/bdist.linux-i686/egg/cElementTree.py, line 7, in ?

   File build/bdist.linux-i686/egg/cElementTree.py, line 4, in 
__bootstrap__

   File 
/usr/lib/python2.4/site-packages/setuptools-0.6b2-py2.4.egg/pkg_resources.py, 
line 799, in resource_filename
 return get_provider(package_or_requirement).get_resource_filename(

   File 
/usr/lib/python2.4/site-packages/setuptools-0.6b2-py2.4.egg/pkg_resources.py, 
line 1228, in get_resource_filename
 self._extract_resource(manager, self._eager_to_zip(name))

   File 
/usr/lib/python2.4/site-packages/setuptools-0.6b2-py2.4.egg/pkg_resources.py, 
line 1249, in _extract_resource
 real_path = manager.get_cache_path(

   File 
/usr/lib/python2.4/site-packages/setuptools-0.6b2-py2.4.egg/pkg_resources.py, 
line 880, in get_cache_path
 self.extraction_error()

   File 
/usr/lib/python2.4/site-packages/setuptools-0.6b2-py2.4.egg/pkg_resources.py, 
line 846, in extraction_error
 raise err

ExtractionError: Can't extract file(s) to egg cache

The following error occurred while trying to extract file(s) to the 
Python egg
cache:

   [Errno 13] Permission denied: '/var/www/.python-eggs'

The Python egg cache directory is currently set to:

   /var/www/.python-eggs

Perhaps your account does not have write access to this directory?  You can
change the cache directory by setting the PYTHON_EGG_CACHE environment
variable to point to an accessible directory.

Now, I already had a /tmp/eggs dir for eggs, and I had a SetEnv 
directive in my vhost config for my Trac vhost (which uses eggs). So I 
moved the SetEnv directive from the vhost config to my global 
httpd.conf. Curious enough, after restarting apache2, I still got the 
same error!! Is there any reason why it may not be picking up the env 
variable that points it to the other directory?

Regards,

Manuzhai

-- 
http://mail.python.org/mailman/listinfo/python-list


Double decoding of strings??

2005-12-05 Thread manuzhai
Hi all,

I have a bit of a problem. I'm trying to use Python to work with some
data which turns out to be garbage. Ultimately, I think the solution
will be to .decode('utf-8') a string twice, but Python doesn't like
doing this the second time. That could possibly be understandable, but
then why does the unicode object have a .decode() method at all?

I get 'WVL Algemeen Altru\xc3\x83\xc2\xafsme genormeerd Afbeelden' at
first.
I .decode('utf-8') this to u'WVL Algemeen Altru\xc3\xafsme genormeerd
Afbeelden'.
I then try to .decode('utf-8') this again, but that gives an error:

Traceback (most recent call last):
  File stdin, line 1, in ?
  File C:\Program Files\Python\lib\encodings\utf_8.py, line 16, in
decode
return codecs.utf_8_decode(input, errors, True)
UnicodeEncodeError: 'ascii' codec can't encode characters in position
18-19: ordinal not in range(128)

If I copy/paste 'WVL Algemeen Altru\xc3\xafsme genormeerd Afbeelden'
and try to .decode('utf-8') it, that works fine, and it gets me the
result I want, which is u'WVL Algemeen Altru\xefsme genormeerd
Afbeelden'.

Why does it work this way? How can I make it work?

Regards,

Manuzhai

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: How did you learn Python?

2004-12-03 Thread Manuzhai
I've not read all of it, and it overlaps a fair bit with Learning 
Python, but the free Dive Into Python reads well and is often cited as a 
good intro for those with programming experience. 
http://diveintopython.org/. It is also available as a dead-tree 
product from APress.
I found Dive Into Python to be very useful when I got my hands wet with 
Python. It's a great read by a funny author, very much recommended.

Regards,
Manuzhai
--
http://mail.python.org/mailman/listinfo/python-list


Re: Book Recommendations

2004-12-03 Thread Manuzhai
Nathan Weston wrote:
I'm new to Python and am looking for a book to get me up to speed
quickly. I'm an experienced programmer and very proficient with Ruby,
so Python is coming easily to me and I don't need a gentle
introduction -- I just need a quick way to get familiar with common
Python idioms and important libraries.
I'm also looking for a gentler book to help introduce some of my
co-workers to python. They are also experienced programmers, but
mostly in C++, with some Java/C# but minimal exposure to scripting
languages.
Check this thread currently going on: 
http://groups.google.com/groups?hl=enlr=c2coff=1safe=offthreadm=coqd91%246m2%241%40news.doit.wisc.eduprev=/groups%3Fhl%3Den%26lr%3D%26c2coff%3D1%26safe%3Doff%26group%3Dcomp.lang.python

Regards,
Manuzhai
--
http://mail.python.org/mailman/listinfo/python-list