How to uninstall/update modules

2008-10-10 Thread pjacobi . de
Dear All,


It seems I don't understand how Python packages are handled. Here's my
specific problem

* I'm on Win32
* I've installed Enthought Python 2.5 because it got all the numerical
stuff included
* Later I tried to install Twisted 8.1

Twisted ended up in
C:\Python\Lib\site-packages\twisted

But there's an older Twisted included in the Enthought distribution.
It is at
C:\Python\Lib\site-packages\Twisted-2.5.0.0002-py2.5-win32.egg

Now, the strange thing (for the uninitiated, like me) is:

When doing a "import twisted" I get to older version in directory
Twisted-2.5.0.0002-py2.5-win32.egg, not the newer version in directory
twisted.

(A) What magic is going on in redirecting the import?
(B) How can I switch to use the newer version?


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


RegExp: "wontmatch"-function

2008-10-13 Thread pjacobi . de
Dear All,

I'm looking for a function which, given a regexp re and  and a string
str, returns
whether re won't match any string starting with str. (so it would
always
return False if str is "" or if str itself matches re -- but that are
only the
easy cases).

I have the vague feeling that the internal workings of the regexp
matcher
can answer the question, but that there's no way to get this result
from Python code.

Any ideas or prior art on how to get this function?

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


Re: python3 - the hardest hello world ever ?

2008-10-14 Thread pjacobi . de
Hi Helmut, All,


> do I miss something (I do hope so) or is switching to Python3
> really hard for Latin1-users?

It's as complicated as ever -- if you have used unicode strings
in the past (as the 3.0 strings now are always unicode strings).

> # sys.setfilesystemencoding('latin1')
This cares about the character encoding in filenames, not
in file content.

sys.setdefaultencoding('iso-8859-1') # or 'latin1'
would do the job, but only in sitecustomize.py. After
initializing, the function is no longer available.

And using it in sitecustomize.py is sort of discouraged.

IMHO the assumptions the typical Python installation makes
about the character encoding used in the system are much too
conservative. E.g. under Windows it should it use
GetLocaleInfo (LOCALE_USER_DEFAULT, LOCALE_IDEFAULTANSICODEPAGE, ...).

Then a lot of things would work out of the box. Of course
including some methods to shoot yourself in the foot, which
you are prevented from by the current behaviour.


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


Re: Anyone Have (XP) 2.4.4 Installed and Can Check This Simple matplotlib Program?

2008-10-14 Thread pjacobi . de
On Oct 15, 6:38 am, "W. eWatson" <[EMAIL PROTECTED]> wrote:
> I'm going to try another stab at this problem again. I'd like someone with
> 2.4.4 and  matplotlib-0.98.3.win32-py2.4exe to try it (below).

IMHO an important detail of your configuration is missing. What's your
numerical library? Did you install a Win32 distribution including a
numerical library (which?), or which package do you have installed
separately?

In general I've used matplotlib with every Python version between 2.2
and 2.5 (inclusive) on Win32 without problem, but the separate
installation
was sometimes a problem.

Regards,
Peter

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


Re: Finding the instance reference of an object

2008-10-31 Thread pjacobi . de
Instead of comparing integers:

> x = 1
> y = x  # does assignment make copies?
> y += 1
> assert x == 1
> => succeeds, which implies that Python makes a copy when assigning

with lists:

> x = [1]
> y = x  # does assignment make copies?
> y += [1]
> assert x == [1]
> => fails, which implies that Python uses references when assigning

Compare lists with tupels:

x = (1,)
y = x  # does assignment make copies?
y += (1,)
assert x == (1,)
=> succeeds, which implies *what*?

Regards,
Peter

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


Re: encoding in lxml

2008-11-03 Thread pjacobi . de
Hi Mike,

> I read an HTML document from a third-party site. It is supposed to be
> in UTF-8, but unfortunately from time to time it's not.

There will be host of more lightweight solutions, but you can opt
to sanizite incominhg HTML with HTML Tidy (python binding available).

It will replace invalid UTF-8 bytes with U+FFFD. It will not
guess a better encoding to use.

If you are sure you don't have HTML sloppiness to correct but only
the
occasional wrong byte, even decoding (with fallback) and encoding
using
the standard codec package will do.

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