Re: unicode .replace not working - why?

2008-10-12 Thread Peter Otten
Kurt Peters wrote:

> I had done that about 21 revisions ago.  

If you litter your module with code that is commented out it is hard to keep
track of what works and what doesn't.

> Nevertheless, why would you think 
> that would work, when the code as shown doesn't?

Because he knows Python? Why don't /you/ try it before asking that question?

A good place to do "exploratory" programming is Python's interactive
interpreter. Here's a sample session:

Python 2.5.1 (r251:54863, Jul 31 2008, 23:17:43)
[GCC 4.1.3 20070929 (prerelease) (Ubuntu 4.1.2-16ubuntu2)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from pyPdf import PdfFileReader as PFR
>>> doc = PFR(open("SUA.pdf"))
>>> text = doc.getPage(3).extractText()
>>> type(text)

>>> text[:200]
u'2/16/087400.8P Table of Contents - Continued  Section Page  
\   xa773.49  New Hampshire (NH) 50
\xa773.50  New Jersey (NJ) 50 \xa773.51  New Mex
  
ico (NM) 51 \xa773.52  New York (NY) 56 \xa773.53  North '
>>> print text[:200].replace(u"\xa7", u"\n")
2/16/087400.8P Table of Contents - Continued  Section Page
73.49  New Hampshire (NH) 50
73.50  New Jersey (NJ) 50
73.51  New Mexico (NM) 51
73.52  New York (NY) 56
73.53  North

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


Re: Efficient Bit addressing in Python.

2008-10-12 Thread Hendrik van Rooyen

Ross Ridge   wrote:

>Unfortunately from your other posts you do seem to be working on
>a single byte a time, so my technique probably won't be efficient.

Its a bit more - the hardware allows for 64 lines in and 64 lines out.

>You probably want just want to be using constants and bit masking.
>Something like:

8< -  standard and and or examples 

This is approximately how I was doing it before I started the thread,
but I was unsatisfied, and started looking for a way to directly
address the bits, more as a further exploration of Python.

>Bit twiddling like this is pretty basic.

Yes it is, and in what we do it is also pervasive,
and I miss my 8051/8031 assembler instructions
where I can do an atomic "jump if bit set then clear' on
a named bit in the bit addressable space, as well as
a direct set or clear of a named bit, without resorting
to anding and oring of bytes.

Now I know that I can never do the jump in python, but
I had hoped that I could get close to the direct set
and clear, and the thread has been useful in that it
has rubbed my nose into a lot of corners where I would
otherwise never have gone. (like the gmpy stuff, for
instance, and mucking around with bitfield-like classes,
and the binascii stuff.)

And I now _almost_ have my direct bit addressability...

However - Python has failed to show me "the one and
only one obvious way".

*grins and ducks*

Thanks to all who responded.

- Hendrik




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


pyuno store OO object into blob

2008-10-12 Thread DarkBlue
Hello

Python 2.5.1
Qt 4.4.0
PyQt 4.4.2
OO 2.4.1
Firebird 2.1

I want to store an openoffice writer object into a blob field using
the pyuno bridge. I read about the possibility of using streams ,
but only see some old basic or java examples .

The writer document has been created and stored into an odf file
on disk. How to get it from there into the blob ?

Thanks for any ideas.

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


parsing javascript

2008-10-12 Thread S.Selvam Siva
I have to do a parsing on webpagesand fetch urls.My problem is ,many urls i
need to parse are dynamically loaded using javascript function
(onload()).How to fetch those links from python? Thanks in advance.
--
http://mail.python.org/mailman/listinfo/python-list


How to detect Chinese in a string?

2008-10-12 Thread lookon
I have a string a(for example, a='中文Chinese'), and I want to know
whether there are some Chinese in the string.

Can someone tell me how to do it? Thanks!
--
http://mail.python.org/mailman/listinfo/python-list


Download CGI

2008-10-12 Thread rodmc
Hi,

I am trying to figure out how to create a Python script which will
open a file from a folder outwith the public_html path and serve it
directly to the user for downloading. The aim being so that the users
cannot see where the file is served from. Is there an easy way to do
this, or an HTML header I am missing or an easy way in Python?

Best,

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


Re: How to detect Chinese in a string?

2008-10-12 Thread Peter Otten
lookon wrote:

> I have a string a(for example, a='中文Chinese'), and I want to know
> whether there are some Chinese in the string.
> 
> Can someone tell me how to do it? Thanks!

See

http://mail.python.org/pipermail/python-list/2008-September/509738.html

Instead of re.findall(...)

you may use

if re.search(...):
print "There are Chinese chars"

Remember to decode the string with the proper encoding first, e. g.

a = a.decode("utf-8")

Peter

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


Re: How to detect Chinese in a string?

2008-10-12 Thread lookon
Get it. Thanks

Peter Otten wrote:
> lookon wrote:
>
> > I have a string a(for example, a='中文Chinese'), and I want to know
> > whether there are some Chinese in the string.
> >
> > Can someone tell me how to do it? Thanks!
>
> See
>
> http://mail.python.org/pipermail/python-list/2008-September/509738.html
>
> Instead of re.findall(...)
>
> you may use
>
> if re.search(...):
> print "There are Chinese chars"
>
> Remember to decode the string with the proper encoding first, e. g.
>
> a = a.decode("utf-8")
>
> Peter
--
http://mail.python.org/mailman/listinfo/python-list


Re: Decrease code redundancy without breaking references

2008-10-12 Thread Frank Malina @ vizualbod.com
There is the following source structure:

/packages/...
/packages/global_settings.py # this is the global settings file
imported from each client settings file
/clients/...
/clients/client1/settings.py # client specific settings file (see code
above), each client is running in its own process so they never clash
/clients/client2/settings.py
/clients/client3/settings.py
...
Now how to remove the repetitive bork, bork, bork if it relies on the
clients settings.
I am still learning python, help appreciated.

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


Re: pyuno store OO object into blob

2008-10-12 Thread Marco Bizzarri
On Sun, Oct 12, 2008 at 1:41 PM, DarkBlue <[EMAIL PROTECTED]> wrote:
> Hello
>
> Python 2.5.1
> Qt 4.4.0
> PyQt 4.4.2
> OO 2.4.1
> Firebird 2.1
>
> I want to store an openoffice writer object into a blob field using
> the pyuno bridge. I read about the possibility of using streams ,
> but only see some old basic or java examples .
>
> The writer document has been created and stored into an odf file
> on disk. How to get it from there into the blob ?
>
> Thanks for any ideas.
>
> --
> http://mail.python.org/mailman/listinfo/python-list
>


I've little experience with firebird, and did this one only with
PostgreSQL; but once you get the odf file, can't you just write on a
temp file and read (and write) from that?

Regards
Marco


-- 
Marco Bizzarri
http://notenotturne.blogspot.com/
http://iliveinpisa.blogspot.com/
--
http://mail.python.org/mailman/listinfo/python-list


H.323 module

2008-10-12 Thread mbmessaoud
Hi

Is there a module in python that implement H.323 protocol

I need such module to test a Gatekeeper or a H.323 module

Any comment is welcome


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


Re: parsing javascript

2008-10-12 Thread Philip Semanchuk


On Oct 12, 2008, at 5:25 AM, S.Selvam Siva wrote:

I have to do a parsing on webpagesand fetch urls.My problem is ,many  
urls i

need to parse are dynamically loaded using javascript function
(onload()).How to fetch those links from python? Thanks in advance.


Selvam,
You can try to find them yourself using string parsing, but that's  
difficult. The closer you want to get to "perfect" at finding URLs  
expressed in JS, the closer you'll get to rewriting a JS interpreter.  
For instance, this is not so hard to understand:

   "http://example.com/";
but this is:
   "http://ZZZ_DOMAIN_ZZZ/index.html".replace(/ZZZ_DOMAIN_ZZZ/,  
the_domain_variable)


This is a long-standing problem for any program that parses Web pages.  
You either have to embed a JS interpreter in your application or just  
ignore the JavaScript. Most Web parsing robots take the latter route.


Good luck
Philip
--
http://mail.python.org/mailman/listinfo/python-list


File Upload Size

2008-10-12 Thread rodmc
Hi,

Is there a way to get the size of a file on a remote machine before it
is uploaded? I would like to write some form of status counter which
is updated as a fie is uploaded, and also to use this feature to
prevent files which are too big from being uploaded.

Best,

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


Re: Define a 2d Array?

2008-10-12 Thread [EMAIL PROTECTED]
On Oct 11, 9:30 pm, [EMAIL PROTECTED] wrote:
>     Jill> How do I define a 2d list?
>
> Python doesn't truly have 2d lists in the way you might think of 2d arrays
> in C or Fortran.  It has 1d lists which can contain any Python object,
> including other lists.  If you wanted to create a 4x5 list you'd do
> something like this:
>
>     N = 4
>     M = 5
>     mylist = []
>     for i in range(N):
>         mylist.append([0.0] * M)
>
> If you are looking to do numeric work with such multidimensional lists you
> should consider the builtin array object or the numpy package:
>
>    http://docs.python.org/dev/library/array.html#module-array
>    http://numpy.scipy.org/
>
> Skip

I think you can do

mylist = [[]] or somesuch...

if you are looking on google for examples you will comonly find them
in spreadsheets..  I have one in the editor part of dex tracker
(available on source forge)  The array will start at zero and ie x[0]
and will keep growing as long as you .append it..  You don't define
the size in advance like you would with other languages..  You need to
have values befour you try to
use a location in the array.
--
http://mail.python.org/mailman/listinfo/python-list


Deviation from object-relational mapping (pySQLFace)

2008-10-12 Thread sulyokpeti
I have made a simple python module to handle SQL databases:
https://fedorahosted.org/pySQLFace/wiki
Its goal to separate relational database stuff (SQL) from algorythmic
code (python). A SQLFace is a facade initialized with a configuration
file (XML). It provides callable command objects for each sql query.
The call substitutes template variables with its parameters, and
returns the result of the query.
I would like to get some opinions on this approach.
Thanks.
--
http://mail.python.org/mailman/listinfo/python-list


Re: please solve

2008-10-12 Thread Raymond Cote

shweta mani wrote:

hi folks,
i have been assigned a project on Python. i need to execute a remote
shell script file from a windows machine through SSH twisted or
paramiko. if it is a normal file then directly with the command  sh
.sh it is getting executed.
self.conn.sendRequest(self, 'exec', common.NS(sh test1.sh), wantReply
= 1)
You could take a look at the Fabric project for some ideas as to how to 
do this:

  

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


Re: python-2.6

2008-10-12 Thread amir

On Oct 2, 9:33 am, [EMAIL PROTECTED] wrote:
> Hi all.
>
> I've installed on may MacOS X 10.4.11 (PPC) Python-2.5.2, numpy and scipy.
> Now I'm interested to insall Python-2.6. My question is: What will happen to
> may scientific modules if now I jump fro 2.5.2 to 2.6? I've to reinstall
> numpy and scipy?
>
> Thanks in advance for any answer.
>
> Luca
>  --
>  Email.it, the professional e-mail, gratis per te:http://www.email.it/f
>
>  Sponsor:
>  Scopri i games pi scaricati su cellulare! Gioca la tua partita!
>  Clicca qui:http://adv.email.it/cgi-bin/foclick.cgi?mid=8272&d=20081002

numpy does not work with python 2.6 in general.
Windows AMD64 numpy 1.2.0 and python 2.6 reported a failed install:
http://www.mail-archive.com/[EMAIL PROTECTED]/msg13131.html

I attempted to install numpy 1.2.0 under Windows x86 and python 2.6
and the installation failed as well.

Let us know if you get it to work on Mac, but do not upgrade to Python
2.6 if you want your numpy code to work on a Windows machine at least
until there is a new numpy release.
--
http://mail.python.org/mailman/listinfo/python-list


Re: Deviation from object-relational mapping (pySQLFace)

2008-10-12 Thread Paul Boddie
On 12 Okt, 17:19, [EMAIL PROTECTED] wrote:
> I have made a simple python module to handle SQL databases:
> https://fedorahosted.org/pySQLFace/wiki
> Its goal to separate relational database stuff (SQL) from algorythmic
> code (python). A SQLFace is a facade initialized with a configuration
> file (XML). It provides callable command objects for each sql query.
> The call substitutes template variables with its parameters, and
> returns the result of the query.
> I would like to get some opinions on this approach.

Not being a fan of object-relational mappers myself, I think that it's
worthwhile to explore other avenues that make database access more
convenient than plain DB-API usage, yet to still expose the benefits
of the database technology. I think that focusing on queries and
operations is the right thing to do, rather than to place the database
schema in a central position like most object-relational mappers do,
and I think that you've made the right decision in preserving the
queries instead of trying to erase all traces of SQL, but I'm not too
convinced by the usage of XML: what I've done myself in various
applications is to define query classes which declare the outputs from
each query as a list stored in a class attribute - something like
this:

class WeatherQuery(Query):

  outputs = ["city", "temp_lo", "temp_hi", "prcp", "date"]
  query = "SELECT city,temp_lo,temp_hi,prcp,date FROM weather"

Naturally, the superclass provides support for the actual query
execution, production of different output representations (such as
XML), and so on. If I wanted to make this more automatic (to stop
people squealing about "DRY" and the repetition of the column names,
although the outputs need not have the same names as the columns), I'd
probably want to parse the SQL (within reason, of course, since SQL is
quite a big language once you start to consider all the different
features).

Still, I don't think there's much to choose between what you've done
and what I've described above, and I think that there's definitely
merit in your approach.

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


Pylab Fails with Runtime Error on Win XP Under Python 2.4

2008-10-12 Thread W. eWatson
I copied the following code from a matplotlib tutorial, and it fails. I'm 
using python 2.4 on Win XP. It's matplotlib-0.98.3.win32-py2.4exe. It fails 
in IDLE with a small window showing a runtime error. Clicking the OK on it 
kills IDLE and the shell. If I double-click on the py file, the console 
briefly appears too quickly to notice any contents. I have read raw to stop 
it. If I execute it from a console window, I'm told the results will be 
available there. I've long forgotten how to get a console window up in Win 
XP. I can strip it all the code way down to the from, and it will fail the 
same way. Bad matplotlib install? Python error?


Here's the code. I added finish() to it.

from pylab import *

def finish():
print; print "Bye"
print
raw_input('Press Enter to Quit')
sys.exit()

t = arange(0.0, 2.0, 0.01)
s = sin(2*pi*t)
plot(t, s, linewidth=1.0)

xlabel('time (s)')
ylabel('voltage (mV)')
title('About as simple as it gets, folks')
grid(True)
show()
finish()



--
   W. eWatson

 (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time)
  Obz Site:  39° 15' 7" N, 121° 2' 32" W, 2700 feet

Web Page: 

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


Data wont stay saved in Database using Pysqlite

2008-10-12 Thread azrael
I am working on an application using Python, wxPython and Sqlite
(Pysqlite)

So my problem is that I can connect top the database. When I open a
dialog through a form I am able to make a select, even insert data
into the database. Even if I open again the Dialog.

But as soon as I close the main frame, the new inserted data is gone.
I don't get it I tried everything. Has anyone any idea. Please any
idea. It's kind of urgent


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


Re: Data wont stay saved in Database using Pysqlite

2008-10-12 Thread azrael
On Oct 12, 8:26 pm, azrael <[EMAIL PROTECTED]> wrote:
> I am working on an application using Python, wxPython and Sqlite
> (Pysqlite)
>
> So my problem is that I can connect top the database. When I open a
> dialog through a form I am able to make a select, even insert data
> into the database. Even if I open again the Dialog.
>
> But as soon as I close the main frame, the new inserted data is gone.
> I don't get it I tried everything. Has anyone any idea. Please any
> idea. It's kind of urgent
>
> Thaks

Done, I' am a moron. How could I forget to commit
--
http://mail.python.org/mailman/listinfo/python-list


Re: Pylab Fails with Runtime Error on Win XP Under Python 2.4

2008-10-12 Thread W. eWatson

Dennis Lee Bieber wrote:

On Sun, 12 Oct 2008 11:24:32 -0700, "W. eWatson"
<[EMAIL PROTECTED]> declaimed the following in comp.lang.python:


available there. I've long forgotten how to get a console window up in Win 
XP. I can strip it all the code way down to the from, and it will fail the 
same way. Bad matplotlib install? Python error?



Well, in my case, I always put a copy of the XP "Command Prompt"
shortcut on the "start" menu, customized for my tastes (font
size/rows/columns). Lacking that, you should find it under:
start/programs/accessories/command prompt. You could also do start/run
and type "cmd".

As for IDLE (which I don't use) -- possibly some conflict between
its graphics system and that of matplotlib...



Here's the code. I added finish() to it.



Runs okay on my system when started from PythonWin, but I'm likely
behind "current"

PythonWin 2.4.3 (#69, Apr 11 2006, 15:32:42) [MSC v.1310 32 bit (Intel)]
on win32.

ActivePython 2.4.3 Build 12 (ActiveState Software Inc.) based on
Python 2.4.3 (#69, Apr 11 2006, 15:32:42) [MSC v.1310 32 bit (Intel)] on
win32

*** Installation started 2007/03/15 21:31 ***
Source: C:\Documents and Settings\All
Users\Documents\matplotlib-0.90.0.win32-py2.4.exe

Let me archive my site-packages directory, and then locate a newer
matplotlib (hmmm, might need to get a newer numpy too){This is getting
nasty -- my numpy had been an egg, and the new installer is an .exe}

Okay -- matplotlib-0.98.3 and numpy-1.2.0 superpack installed...
Trying your code in a fresh PythonWin

Nope... That runs too (this time the left/right navigation arrows
displayed, but the pop-up help over the buttons wasn't).

And -- I just noticed, it IS using tk for plotting, and IDLE is also
tk; good place for conflicting event loops.


Thanks.

Oddly when I use cmd, it gets me to settings and docs. If I try c:\whatever 
I get a msg, and it remains in the same folder.


I guess PythonWin is a download for another IDE than IDLE. Will modules be 
available like mathplotlib if I install it, or do I have to establish them 
for it? I'll look PythonWin once I get past the cmd operation.




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


Re: Split entries from LDAP

2008-10-12 Thread paul

Lars schrieb:

I got all the entries in the variable "raw_res" and I now got some
doubts on how to split each value up in every entry. Belove you can
see one of entries printed from the loop.
cn=world.dom.dk,ou=Hosts,o=Users,dc=dom,dc=dk', {'ipHostNumber':
['192.168.0.43'], 'cn': ['world.dom.dk'], 'description':
['Mail&webserver']})"

I've tried different things, but don't quite know to split the tuple.
search_s() returns a tuple of lenght 2. The first entry is the DN, the 
second entry is a dictionary with attributes as keys and lists of values 
as values. Possible function to handle this (untested):


def print_entry(entry):
  print "Got Entry for DN: %s" % entry[0]
  print "Attributes:"
  for key, value in entry[1].items():
print "\tKey: %s" % key
print "\tValue(s): %s" ", ".join(value)
print

the ", ".join(value) creates a string from a list, check the docs for 
dictionaries for other syntax elements.


cheers
 Paul

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


Re: Pylab Fails with Runtime Error on Win XP Under Python 2.4

2008-10-12 Thread Benjamin Kaplan
On Sun, Oct 12, 2008 at 3:56 PM, W. eWatson <[EMAIL PROTECTED]> wrote:

>
> Thanks.
>
> Oddly when I use cmd, it gets me to settings and docs. If I try c:\whatever
> I get a msg, and it remains in the same folder.
>


Are you just typing "C:\whatever" or did you type in "chdir C:\whatever"?
--
http://mail.python.org/mailman/listinfo/python-list


Re: Define a 2d Array?

2008-10-12 Thread John Machin
On Oct 12, 1:30 pm, [EMAIL PROTECTED] wrote:
>     Jill> How do I define a 2d list?

>
> If you are looking to do numeric work with such multidimensional lists you
> should consider the builtin array object or the numpy package:
>
>    http://docs.python.org/dev/library/array.html#module-array

The built-in array module does *NOT* support multidimensional arrays.

The referenced docs say (first two sentences) "This module defines an
object type which can compactly represent an array of basic values:
characters, integers, floating point numbers. Arrays are sequence
types and behave very much like lists, except that the type of objects
stored in them is constrained."

"behave very much like lists" is in no way to be construed as
supporting multiple dimensions, and that type constraint means that
you can't even have an array of arrays.

However you can have a list of arrays; this can be a memory-efficient
solution for some 2D applications. Note that arrays are not
recommended for CPU efficiency, as (in general) each time you access
an array element, a new Python object must be created. Escape clause:
CPython and single-byte arrays (type 'c' and some values of types 'b'
and 'B').

Cheers,
John
--
http://mail.python.org/mailman/listinfo/python-list


Re: PIL on windows XP x64 (64-bit)?

2008-10-12 Thread Berco Beute
Investigated this a little more. Since I only needed to resize an
image I thought going through all the hoops of building PIL was too
much effort and took a look at PythonMagick. Turned out I had to build
that myself as well. Am I the first that wants to do image
manipulation on x64 using python? Are there alternatives?

Anyway, I guess that if I knew the hoops you have to jump to when
using windows xp 64-bit instead of 32-bit I would have stayed with the
latter.

2B

On Oct 11, 12:02 am, Berco Beute <[EMAIL PROTECTED]> wrote:
> Has anybody here got PIL (the Image lib) working on Windows XP x64 (64-
> bit)? There is no version available for that platform from
> pythonware.com.
>
> Thanks,
> 2B

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


Re: Pylab Fails with Runtime Error on Win XP Under Python 2.4

2008-10-12 Thread W. eWatson

Dennis Lee Bieber wrote:

On Sun, 12 Oct 2008 12:56:26 -0700, "W. eWatson"
<[EMAIL PROTECTED]> declaimed the following in comp.lang.python:


Oddly when I use cmd, it gets me to settings and docs. If I try c:\whatever 
I get a msg, and it remains in the same folder.


That's likely the defined "home directory" on your machine.

Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.

C:\Documents and Settings\Dennis Lee Bieber>cd c:\bin

C:\bin>e:

E:\>cd "UserData\Dennis Lee Bieber\My Documents\Python Progs"

E:\UserData\Dennis Lee Bieber\My Documents\Python Progs>dir
 Volume in drive E is Data
 Volume Serial Number is 2626-D991

 Directory of E:\UserData\Dennis Lee Bieber\My Documents\Python Progs

08/23/2008  01:26 PM  .
08/23/2008  01:26 PM  ..
08/23/2008  01:26 PM 1,089 azel_interp.py
04/22/2007  04:43 PM 1,622 binadd.py
04/22/2007  06:03 PM 1,485 binadd2.py
12/11/2006  10:21 PM   119,889 BookList.zip

06/13/2008  08:46 PM 1,929 timing.py
11/03/2007  10:31 PM56 trips.dat
03/31/2006  11:31 PM10 update_log
11/30/2005  10:11 AM   104 ut_00.py
 112 File(s)397,123,218 bytes
   2 Dir(s)  270,550,671,360 bytes free

E:\UserData\Dennis Lee Bieber\My Documents\Python Progs>

	NOTE: to change directory you need to enter the command: 
			cd new-directory

Without the "cd" your entry is being treated as the path to an
executable program -- and directories, of course, are not executable. To
change to a different partition/drive, you do enter just the drive
letter and a colon. And you need to do that separately -- each drive
maintains a "current directory"

E:\UserData\Dennis Lee Bieber\My Documents\Python Progs>cd c:\bin

E:\UserData\Dennis Lee Bieber\My Documents\Python Progs>dir
 Volume in drive E is Data
 Volume Serial Number is 2626-D991

 Directory of E:\UserData\Dennis Lee Bieber\My Documents\Python Progs



E:\UserData\Dennis Lee Bieber\My Documents\Python Progs>c:

C:\bin>

Notice how changing drive to C: put me into the bin directory
specified earlier. If I now enter e:, I'll be back to the Python Progs
directory.

I guess PythonWin is a download for another IDE than IDLE. Will modules be 
available like mathplotlib if I install it, or do I have to establish them 
for it? I'll look PythonWin once I get past the cmd operation.



It comes supplied with the ActiveState Python download (which also
includes the win32 extensions). I believe it can also be obtained as a
stand-alone with the win32 stuff.

The win32 extensions are: 
http://sourceforge.net/project/platformdownload.php?group_id=78018 (just

checked, PythonWin is included)
I worked my way into the folder where the py program is, but couldn't 
executed. Just entering aprog.py, run aprog.py or exec aprog.py didn't work.


--
   W. eWatson

 (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time)
  Obz Site:  39° 15' 7" N, 121° 2' 32" W, 2700 feet

Web Page: 

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


Re: File Upload Size

2008-10-12 Thread Mike Driscoll
On Oct 12, 9:34 am, rodmc <[EMAIL PROTECTED]> wrote:
> Hi,
>
> Is there a way to get the size of a file on a remote machine before it
> is uploaded? I would like to write some form of status counter which
> is updated as a fie is uploaded, and also to use this feature to
> prevent files which are too big from being uploaded.
>
> Best,
>
> rod

Looks like ftplib does that. Check the docs:
http://www.python.org/doc/2.5.2/lib/module-ftplib.html

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


Upgrading from 2.5 to 2.6

2008-10-12 Thread Daniel Klein
Are there any guidelines for upgrading from 2.5 to 2.6?

Do you have to uninstall 2.5, or does the installer do that for you?

I have wxPython, mod_python and Django installed. Will these have to
reinstalled/reconfigured for 2.6?

Platform: Windows XP Pro SP3

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


Re: Define a 2d Array?

2008-10-12 Thread skip

Eric> I think you can do

Eric> mylist = [[]] or somesuch...

That won't do what you want.  You've defined a list with a single element
(another list).  You might have been thinking of something like this:

>>> N = 4
>>> M = 5
>>> mylist = [[0.0] * M] * N

While to the casual glance it looks like what you want:

>>> print mylist
[[0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 
0.0], [0.0, 0.0, 0.0, 0.0, 0.0]]

assigning to an element of this structure demonstrates its shortcoming:


>>> mylist[1][1] = 42.7
>>> print mylist
[[0.0, 42.703, 0.0, 0.0, 0.0], [0.0, 42.703, 0.0, 
0.0, 0.0], [0.0, 42.703, 0.0, 0.0, 0.0], [0.0, 42.703, 
0.0, 0.0, 0.0]]

There is just one copy of [0.0] * M referenced N times.

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


Re: PIL on windows XP x64 (64-bit)?

2008-10-12 Thread Martin v. Löwis
Berco Beute wrote:
> Investigated this a little more. Since I only needed to resize an
> image I thought going through all the hoops of building PIL was too
> much effort and took a look at PythonMagick. Turned out I had to build
> that myself as well. Am I the first that wants to do image
> manipulation on x64 using python? Are there alternatives?

I would install the 32-bit Python interpreter.

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


Re: Pylab Fails with Runtime Error on Win XP Under Python 2.4

2008-10-12 Thread John Machin
On Oct 13, 9:07 am, "W. eWatson" <[EMAIL PROTECTED]> wrote:

>
> I worked my way into the folder where the py program is, but couldn't
> executed. Just entering aprog.py, run aprog.py or exec aprog.py didn't work.

One wouldn't expect the "run" or the "exec" to work.

Try these in this order:
python aprog.py
\python24\python aprog.py
c:\python24\python aprog.py

and instead of "didn't work", tell us what message you get. Also
consider telling us where your Python 2.4 is installed, and what you
see when you execute the PATH command.
--
http://mail.python.org/mailman/listinfo/python-list


Re: Pylab Fails with Runtime Error on Win XP Under Python 2.4

2008-10-12 Thread W. eWatson

John Machin wrote:

On Oct 13, 9:07 am, "W. eWatson" <[EMAIL PROTECTED]> wrote:


I worked my way into the folder where the py program is, but couldn't
executed. Just entering aprog.py, run aprog.py or exec aprog.py didn't work.


One wouldn't expect the "run" or the "exec" to work.

Try these in this order:
python aprog.py
\python24\python aprog.py
c:\python24\python aprog.py

and instead of "didn't work", tell us what message you get. Also
consider telling us where your Python 2.4 is installed, and what you
see when you execute the PATH command.

The first one requires a compile program.
The second required a path, probably back to my c-drive
The third one is too ghastly to think about, unless I move aprog.py to the 
python folder.


I think I'll compile it and try.

--
   W. eWatson

 (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time)
  Obz Site:  39° 15' 7" N, 121° 2' 32" W, 2700 feet

Web Page: 

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


Mail reader & spam

2008-10-12 Thread Aaron "Castironpi" Brady
Hello all,

I'm hesitating to change news readers because I like Google's
interface.  In the interests of discussion, I'd make better
contributions without it, if only because it's a known spam source,
but its reader format beats the alternatives I've seen.  I checked out
the 'nntplib' module to see if some hybrid with Thunderbird and GMane,
for example, would be possible.  I don't think it would be that hard,
but before I put in the effort, I wanted feedback.  Here's what I like
about it.

When new messages come, the entire thread they're in is moved to the
top of the list.  You can click on it and browse the entire topic, and
compose your reply right under the message you're replying to.  You
can also mark topics, to keep updated on when and what replies to your
messages come too.  I haven't found all these features in another
reader, including Outlook, Thunderbird, and GMane.  You've noticed
Thunderbird isn't the best for discussing Python, due to its colored
indents instead of caret marks in the interpreter prompt..  Free is a
big plus too.

What's my best option?  Hijack Google's reader, and override 'reply'
to use an SMTP account?  Write my own, perhaps sorting marked and
unmarked messages separately?

It's of course everyone's choices whether to block Google or not, and
miss out on anyone that posts them through Google.  I don't think the,
'Well, if you insist' tactic is as cooperative and productive as
acknowledging, 'It's a big spam source, maybe I can find a provider
that isn't so beneficial to blacklist'.

Is there any resolution to the dilemma?
--
http://mail.python.org/mailman/listinfo/python-list


Re: urlparse import Faillure

2008-10-12 Thread Robert Hancock
On Oct 10, 1:48 pm, Wojtek Walczak <[EMAIL PROTECTED]> wrote:
> On Thu, 9 Oct 2008 22:47:58 -0700 (PDT), Robert Hancock wrote:
>  import CGIHTTPServer
> ...
> > ImportError: cannot import name urlparse
>
> ...
> > It points to the third line of the comment.  Any ideas on how to
> > proceed with the debugging?
>
> Have you tried getting rid of this comment? I doubt that
> the comment is a reason of this error, but it seems that
> it shadows the real problem. Moreover, try to import urlparse
> itself and check if you got the pyc file for urlparse.py
> in your */lib/python2.5/ directory.
>
> --
> Regards,
> Wojtek Walczak,http://tosh.pl/gminick/

It turns out that I had a script named urlparse.py in my path in
another directory.  I'm still not sure why the traceback pointed to
the comment.
--
http://mail.python.org/mailman/listinfo/python-list


Re: Pylab Fails with Runtime Error on Win XP Under Python 2.4

2008-10-12 Thread W. eWatson

Dennis Lee Bieber wrote:

On Sun, 12 Oct 2008 15:07:57 -0700, "W. eWatson"
<[EMAIL PROTECTED]> declaimed the following in comp.lang.python:


I worked my way into the folder where the py program is, but couldn't 
executed. Just entering aprog.py, run aprog.py or exec aprog.py didn't work.


Try:
python aprog.py

If that doesn't work, you'll need to check your environment variable
PATH to make sure the directory with the python interpreter is on it...
(I've added spaces and/or newlines after the ; to make for easier
reading)

Path=E:\Python24\; E:\GNAT\2008\bin; C:\WINDOWS\system32; C:\WINDOWS;
C:\WINDOWS\System32\Wbem; C:\Program Files\SciTE; 
C:\Program Files\Java\jre1.6.0_03\bin; 
C:\Program Files\Java\jdk1.6.0_03\bin; 
C:\Program Files\Common Files\Adobe\AGL; C:\Tcl\bin;

C:\Program Files\Common Files\Roxio Shared\9.0\DLLShared\;
C:\Program Files\Common Files\Roxio Shared\DLLShared\;
C:\PROGRA~1\MySQL\MySQL Server 5.0\bin;
C:\Program Files\TortoiseSVN\bin; E:\GNAT\GtkAda\bin; C:\MSSQL7\BINN;
c:\PROGRA~1\sdb\programs\bin; c:\PROGRA~1\sdb\programs\pgm; c:\Regina;
e:\Python24\Scripts

It IS possible to set an association so that *.py will invoke python
as the processor. Part of is the environment variable pathext...

PATHEXT=.COM;.EXE;.BAT;.pyw;.py;.pyo;.pyc;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.tcl

But I think something else was required... Ah

FTYPE Python.File="E:\Python24\python.exe" "%1" %*



I entered at the H:\..\python_dev\ prompt
FTYPE Python.File="C:\Python24\python.exe" aprog.py
but nothing happened. Nothing at all in the console window other than it 
still shows the folder path in the prompt. Well not quite. It just responded 
with python.exe" aprog.py.


Is there some way to copy in and out of the console. A copy/paste seems to 
get nowhere.


It's odd that I cannot widen the console window. It shows <---> when I grab 
a side.


Maybe I'll compile the code, as suggested by a poster above. I don't think 
IDLE will do that, but I can probably find something that will.


Ah, I found py2exe and installed it. It shows up nowhere in my Start->All 
Programs. It may be in the list under Python. I see a command line entry off 
that men. I don't think it was there. Off for more exploring.



--
   W. eWatson

 (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time)
  Obz Site:  39° 15' 7" N, 121° 2' 32" W, 2700 feet

Web Page: 

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


Re: Upgrading from 2.5 to 2.6

2008-10-12 Thread Benjamin Kaplan
On Sun, Oct 12, 2008 at 6:16 PM, Daniel Klein <[EMAIL PROTECTED]>wrote:

> Are there any guidelines for upgrading from 2.5 to 2.6?
>
> Do you have to uninstall 2.5, or does the installer do that for you?
>
> I have wxPython, mod_python and Django installed. Will these have to
> reinstalled/reconfigured for 2.6?
>
> Platform: Windows XP Pro SP3
>

You can actually have 2 python installations side by side. 2.5 is located in
C:\Python25, and 2.6 will go into C:\Python26.

Each version of Python has its own site-packages folder, so you'll need to
reinstall them. For pure python libraries like django, you can just
reinstall the version you already have. For wrapped c and c++ libraries
(like wxPython and mod_python), you need to download python 2.6 versions. I
don't think mod_python has a 2.6 binary out yet, so you'll have to either
compile from source or wait for the next release if you want to upgrade
python.
--
http://mail.python.org/mailman/listinfo/python-list


Re: Pylab Fails with Runtime Error on Win XP Under Python 2.4

2008-10-12 Thread W. eWatson

Ah, a tiny break through. I got
C:\Python24\python myprogram.py aprog.py. I copied the program to this folder.

I don't seem to be able to copy the window, so I see pretty much what I had 
before from a dialog that popped up, except it adds:
Fatal Pyton error: Pystring_InterInPlace: strings only please! The rest is 
about the run time error.

This (Pystring) seems quite relevant, but I have no idea what.







--
   W. eWatson

 (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time)
  Obz Site:  39° 15' 7" N, 121° 2' 32" W, 2700 feet

Web Page: 

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


Re: Define a 2d Array?

2008-10-12 Thread thomas . p . krauss
On Oct 11, 9:19 pm, Jillian Calderon <[EMAIL PROTECTED]>
wrote:
> How do I define a 2d list?
>
> For instance, to define a 4 by 5 list, I wanted to do this:
> n=4
> m=5
> world = [n][m]
> However, it gives me an invalid syntax error saying the index is out
> of range.

Here are some examples of how you can use list comprehensions to do
this:

In [1]: n=4

In [2]: m=5

In [3]: world = [[[] for ni in range(n)] for mi in range(m)]

In [4]: world
Out[4]:
[[[], [], [], []],
 [[], [], [], []],
 [[], [], [], []],
 [[], [], [], []],
 [[], [], [], []]]

In [5]: world[0][0]
Out[5]: []

In [6]: len(world)
Out[6]: 5

In [7]: len(world[0])
Out[7]: 4

In [8]: world = [[[ni+mi*n] for ni in range(n)] for mi in range(m)]

In [9]: world
Out[9]:
[[[0], [1], [2], [3]],
 [[4], [5], [6], [7]],
 [[8], [9], [10], [11]],
 [[12], [13], [14], [15]],
 [[16], [17], [18], [19]]]

Best,
  Tom
--
http://mail.python.org/mailman/listinfo/python-list


Re: unicode .replace not working - why?

2008-10-12 Thread Kurt Peters
Thanks...

  On a side note, do you really think the function call wouldn't interpret 
the unichr before the function call?
Kurt


"Peter Otten" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> Kurt Peters wrote:
>
>> I had done that about 21 revisions ago.
>
> If you litter your module with code that is commented out it is hard to 
> keep
> track of what works and what doesn't.
>
>> Nevertheless, why would you think
>> that would work, when the code as shown doesn't?
>
> Because he knows Python? Why don't /you/ try it before asking that 
> question?
>
> A good place to do "exploratory" programming is Python's interactive
> interpreter. Here's a sample session:
>
> Python 2.5.1 (r251:54863, Jul 31 2008, 23:17:43)
> [GCC 4.1.3 20070929 (prerelease) (Ubuntu 4.1.2-16ubuntu2)] on linux2
> Type "help", "copyright", "credits" or "license" for more information.
 from pyPdf import PdfFileReader as PFR
 doc = PFR(open("SUA.pdf"))
 text = doc.getPage(3).extractText()
 type(text)
> 
 text[:200]
> u'2/16/087400.8P Table of Contents - Continued  Section 
> Page
> \   xa773.49  New Hampshire (NH) 50
> \xa773.50  New Jersey (NJ) 50 \xa773.51  New Mex
> ico (NM) 51 \xa773.52  New York (NY) 56 \xa773.53  North '
 print text[:200].replace(u"\xa7", u"\n")
> 2/16/087400.8P Table of Contents - Continued  Section Page
> 73.49  New Hampshire (NH) 50
> 73.50  New Jersey (NJ) 50
> 73.51  New Mexico (NM) 51
> 73.52  New York (NY) 56
> 73.53  North
>
> Peter 


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


Re: unicode .replace not working - why?

2008-10-12 Thread Kurt Peters
Thanks,
  clearly though, my "For loop" shows a character using ord(167), and using 
print repr(textu), it shows the character \xa7 (as does Peter Oten's post). 
So you can see what I see, here's the document I'm using - the Special Use 
Airspace document at
http://www.faa.gov/airports_airtraffic/air_traffic/publications/
which is = JO 7400.8P (PDF)

if you just look at page three, it shows those unusual characters.
Once again, using a "simple" replace, doesn't seem to work.  I can't seem to 
figure out how to get it to work, despite all the great posts attempting to 
shed some light on the subject.

Regards,
Kurt


"John Machin" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
On Oct 12, 7:05 am, Kurt Peters <[EMAIL PROTECTED]> wrote:
> I'm using the code below to read a pdf document, and it has no line feeds
> or carriage returns in the imported text. I'm therefore trying to just
> replace the symbol that looks like it would be an end of line (found by
> examining the characters in the "for loop") unichr(167).
> Unfortunately, the replace isn't working, does anyone know what I'm
> doing wrong? I tried a number of things so I left comments in place as a
> subset of the bunch of things I tried to no avail.

This is the first time I've ever looked inside a PDF file, and *only*
one file, but:

import pyPdf, sys
filename = sys.argv[1]
doc = pyPdf.PdfFileReader(open(filename, "rb"))
for pageno in range(doc.getNumPages()):
page = doc.getPage(pageno)
textu = page.extractText()
print "pageno", pageno
print type(textu)
print repr(textu)

gives me  and text with lots of \n at places where
you'd expect them.

The only problem I can see is that where I see (and expect) quotation
marks (U+201C and U+201D) when viewing the file with Acrobat Reader,
the repr is showing \ufb01 and \ufb02. Similar problems with em-dashes
and apostrophes. I had a bit of a poke around:

1. repr(result of FlateDecode) includes *both* the raw bytes \x93 and
\x94, *and* the octal escapes \\223 and \\224 (which pyPdf translates
into \x93 and \x94).

2. Then pyPdf appears to push these through a fixed transformation
table (_pdfDocEncoding in generic.py) and they become \ufb01 and
\ufb02.

3. However:
|>>> '\x93\x94'.decode('cp1252') # as suspected
|u'\u201c\u201d' # as expected
|>>>

AFAICT there is only one reference to encoding in the pyPdf docs: "if
pyPdf was unable to decode the string's text encoding" ...

Cheers,
John 


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


Re: Define a 2d Array?

2008-10-12 Thread Jillian Calderon
Thanks, everyone. All of your help solved at least my data storage
problem!
--
http://mail.python.org/mailman/listinfo/python-list


Re: Pylab Fails with Runtime Error on Win XP Under Python 2.4

2008-10-12 Thread W. eWatson
Thanks for the help, but I'm bowing out of this graphics problem. This 
should have been a snap, but has turned into a detour. I'll get back to the 
 python program I was considering for it, and just work without the scatter 
plot. It's easily done. It would just look prettier in a plot.


The meat of the matter is the Fatal error msg I copied below. To me it 
indicates a serious error. Maybe some developer can sort it out.


From above post.
++
Ah, a tiny break through. I got
C:\Python24\python myprogram.py aprog.py. I copied the program to this folder.

I don't seem to be able to copy the window, so I see pretty much what I had 
before from a dialog that popped up, except it adds:


Fatal Python error: Pystring_InterInPlace: strings only please! <-Meat!

The rest is about the run time error [, and of zippo help].

This (Pystring) seems quite relevant, but I have no idea what.
+++
--
   W. eWatson

 (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time)
  Obz Site:  39° 15' 7" N, 121° 2' 32" W, 2700 feet

Web Page: 

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


Re: unicode .replace not working - why?

2008-10-12 Thread Mark Tolonen

In your original code:

  textu.replace(unichr(167),'\n')

as Dennis suggested (but maybe you were distracted by his 'fn' replacement, 
so I'll leave it out):


  textu = textu.replace(unichr(167),'\n')

.replace does not modify the string in place.  It returns the modified 
string, so you have to reassign it.


-Mark

"Kurt Peters" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]

Thanks,
 clearly though, my "For loop" shows a character using ord(167), and using 
print repr(textu), it shows the character \xa7 (as does Peter Oten's 
post). So you can see what I see, here's the document I'm using - the 
Special Use Airspace document at

http://www.faa.gov/airports_airtraffic/air_traffic/publications/
which is = JO 7400.8P (PDF)

if you just look at page three, it shows those unusual characters.
Once again, using a "simple" replace, doesn't seem to work.  I can't seem 
to figure out how to get it to work, despite all the great posts 
attempting to shed some light on the subject.


Regards,
Kurt


"John Machin" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]

On Oct 12, 7:05 am, Kurt Peters <[EMAIL PROTECTED]> wrote:

I'm using the code below to read a pdf document, and it has no line feeds
or carriage returns in the imported text. I'm therefore trying to just
replace the symbol that looks like it would be an end of line (found by
examining the characters in the "for loop") unichr(167).
Unfortunately, the replace isn't working, does anyone know what I'm
doing wrong? I tried a number of things so I left comments in place as a
subset of the bunch of things I tried to no avail.


This is the first time I've ever looked inside a PDF file, and *only*
one file, but:

import pyPdf, sys
filename = sys.argv[1]
doc = pyPdf.PdfFileReader(open(filename, "rb"))
for pageno in range(doc.getNumPages()):
   page = doc.getPage(pageno)
   textu = page.extractText()
   print "pageno", pageno
   print type(textu)
   print repr(textu)

gives me  and text with lots of \n at places where
you'd expect them.

The only problem I can see is that where I see (and expect) quotation
marks (U+201C and U+201D) when viewing the file with Acrobat Reader,
the repr is showing \ufb01 and \ufb02. Similar problems with em-dashes
and apostrophes. I had a bit of a poke around:

1. repr(result of FlateDecode) includes *both* the raw bytes \x93 and
\x94, *and* the octal escapes \\223 and \\224 (which pyPdf translates
into \x93 and \x94).

2. Then pyPdf appears to push these through a fixed transformation
table (_pdfDocEncoding in generic.py) and they become \ufb01 and
\ufb02.

3. However:
|>>> '\x93\x94'.decode('cp1252') # as suspected
|u'\u201c\u201d' # as expected
|>>>

AFAICT there is only one reference to encoding in the pyPdf docs: "if
pyPdf was unable to decode the string's text encoding" ...

Cheers,
John



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


ANN: Humerus 2.0

2008-10-12 Thread Greg Ewing

Humerus 2.0 is now available:

   http://www.cosc.canterbury.ac.nz/greg.ewing/python/Albow/Humerus-2.0.0.tar.gz

Online documentation:

   http://www.cosc.canterbury.ac.nz/greg.ewing/python/Albow/Humerus-2.0.0/doc/

This version of Humerus has been extensively revised from the previous one.
Instead of a pile of code to be cut and pasted, it is now a proper library
made up of reusable classes, with detailed documentation and some example code
included.

What is Humerus?


Humerus is a companion to the Albow widget library for PyGame. It provides a
framework for games made up of a sequence of levels, including user interface
and back-end logic for loading levels, saving and restoring game state and
sundry other details. There is also optional support for a built-in level
editor, including code for loading and saving levels to be edited, and asking
whether to save modified levels.

Albow can be found here:

   http://www.cosc.canterbury.ac.nz/greg.ewing/python/Albow/
--
http://mail.python.org/mailman/listinfo/python-list


Re: python-2.6

2008-10-12 Thread Terry Reedy

[EMAIL PROTECTED] wrote:


I attempted to install numpy 1.2.0 under Windows x86 and python 2.6
and the installation failed as well.

Let us know if you get it to work on Mac, but do not upgrade to Python
2.6 if you want your numpy code to work on a Windows machine at least
until there is a new numpy release.


You can have multiple Python versions installed, each in their own 
directory.  The installer gives you the choice to have the new one grab 
the .pyx extensions or not.


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


Re: type-checking support in Python?

2008-10-12 Thread Lawrence D'Oliveiro
In message <[EMAIL PROTECTED]>, Steven D'Aprano
wrote:

> ... just for the record "dimensions" are not "units".

Yeah, OK. "unit" = "dimensions" x "multiplier".

Where "multiplier" can be arbitarily set to 1 for SI units.
--
http://mail.python.org/mailman/listinfo/python-list


Re: type-checking support in Python?

2008-10-12 Thread Lawrence D'Oliveiro
In message
<[EMAIL PROTECTED]>, Bas
wrote:

> What they taught me as a physics undergrad is to always convert random
> units given as input to SI units as soon as possible, do all your
> calculations internally in SI units and (only if really needed)
> convert back to arbitrary units on output.

If only NASA's Mars Climate Orbiter engineers had followed that rule. :)
--
http://mail.python.org/mailman/listinfo/python-list


Re: Upgrading from 2.5 to 2.6

2008-10-12 Thread Martin v. Löwis
> Are there any guidelines for upgrading from 2.5 to 2.6?

Dear Daniel,

Python 2.5 and 2.6 can coexist, so there isn't any need for some
kind of upgrade procedure. Installing 2.6 will not affect your
2.5 installation.

> Do you have to uninstall 2.5, or does the installer do that for you?

No. After installing 2.6, 2.5 will still be around, with all its
add-ons. If you want 2.5 to disappear, you should uninstall
it first.

> I have wxPython, mod_python and Django installed. Will these have to
> reinstalled/reconfigured for 2.6?

Yes, that will be necessary.

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


ANN: M2Crypto 0.19.1

2008-10-12 Thread Heikki Toivonen
The 0.19.1 release fixes the build when OpenSSL has been configured
without EC support, thanks to Miloslav Trmac.

M2Crypto is the most complete Python wrapper for OpenSSL featuring RSA,
DSA, DH, HMACs, message digests, symmetric ciphers (including AES); SSL
functionality to implement clients and servers; HTTPS extensions to
Python's httplib, urllib, and xmlrpclib; unforgeable HMAC'ing
AuthCookies for web session management; FTP/TLS client and server;
S/MIME; ZServerSSL: A HTTPS server for Zope and ZSmime: An S/MIME
messenger for Zope. M2Crypto can also be used to provide SSL for Twisted.

Requirements:

* Python 2.3 or newer
  o m2urllib2 requires Python 2.4 or newer
* OpenSSL 0.9.7 or newer
  o Some optional new features will require OpenSSL 0.9.8 or newer
* SWIG 1.3.24 or newer required for building
  o SWIG 1.3.30 or newer may be required with Python 2.5 or newer and
  Python 2.4 with Py_ssize_t patches

Download link available from the M2Crypto homepage:
http://chandlerproject.org/Projects/MeTooCrypto

Or use easy_install (may not work on all systems): easy_install M2Crypto

-- 
  Heikki Toivonen - http://www.heikkitoivonen.net
--
http://mail.python.org/mailman/listinfo/python-list


Re: unicode .replace not working - why?

2008-10-12 Thread Martin v. Löwis
>   On a side note, do you really think the function call wouldn't interpret 
> the unichr before the function call?

Dennis' main point was not that you can reuse fn (which he suggested
just as performance improvement), but that you need to assign the result
of .replace back to textu.

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


Re: Upgrading from 2.5 to 2.6

2008-10-12 Thread Mensanator
On Oct 12, 11:22�pm, "Martin v. L�wis" <[EMAIL PROTECTED]> wrote:
> > Are there any guidelines for upgrading from 2.5 to 2.6?
>
> Dear Daniel,
>
> Python 2.5 and 2.6 can coexist, so there isn't any need for some
> kind of upgrade procedure. Installing 2.6 will not affect your
> 2.5 installation.
>
> > Do you have to uninstall 2.5, or does the installer do that for you?
>
> No. After installing 2.6, 2.5 will still be around, with all its
> add-ons. If you want 2.5 to disappear, you should uninstall
> it first.
>
> > I have wxPython, mod_python and Django installed. Will these have to
> > reinstalled/reconfigured for 2.6?
>
> Yes, that will be necessary.
>
> Regards,
> Martin

A reason you might want to keep version 2.5 is that
even systems that supposedly work in 2.6 sometimes
don't because they never actually tested it with
2.6. That's rare, but it does happen, so you might
want 2.5 around until you verify that everything
works in 2.6 like it's supposed to.
--
http://mail.python.org/mailman/listinfo/python-list


Re: Upgrading from 2.5 to 2.6

2008-10-12 Thread Tim Roberts
Daniel Klein <[EMAIL PROTECTED]> wrote:
>
>Are there any guidelines for upgrading from 2.5 to 2.6?
>
>Do you have to uninstall 2.5, or does the installer do that for you?

Neither.  It will be installed in a separate directory.  If you don't want
2.5 any more, you can uninstall it yourself from Control Panel.

>I have wxPython, mod_python and Django installed. Will these have to
>reinstalled/reconfigured for 2.6?

Yes.  Each major version (2.4, 2.5, 2.6) is separate, and has its own DLL.
Further, assuming you installed these using MSIs or Windows exes, you will
have to download new versions of them.
-- 
Tim Roberts, [EMAIL PROTECTED]
Providenza & Boekelheide, Inc.
--
http://mail.python.org/mailman/listinfo/python-list