Author of a Python Success Story Needs a Job!

2009-12-27 Thread Andrew Jonathan Fine
To whom it may concern,

I am the author of "Honeywell Avoids Documentation Costs with Python
and other Open Standards!"

I was laid off by Honeywell several months after I had made my
presentation in the 2005 Python Conference.

Since then I have been unable to find work either as a software
engineer or in any other capacity, even at service jobs.  I've sent
resumes and have been consistently ignored.

What I have been doing in the meantime is to be a full time homemaker
and parent.   As a hobby to keep me sane, I am attempting to retrain
part time at home as a jeweler and silversmith, and I sometimes used
Python for generating and manipulating code for CNC machines.

For my own peace of mind, however, I very much want to be doing
software work again because I feel so greatly ashamed to have
dedicated my life to learning and working in the field only to now
find myself on the scrap heap.

I find it highly ironic that my solution is still being advertised on
the Python web site but that I, the author of that solution, am now a
long term unemployment statistic.

Please, if there is anyone out there who needs a highly creative and
highly skilled software designer for new and completely original work,
then for the love of God I implore you to contact me.

A mind is a terrible thing to waste.

Sincerely,

Andrew Jonathan Fine
BEE, MSCS, 15 years experience, 5 in Python, the rest in C/C++,
about 1/3 embedded design and device drivers, and 2/3 in applications.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Question-Answer based web App

2009-12-27 Thread Gabriel Genellina
En Fri, 25 Dec 2009 16:13:14 -0300, aditya shukla  
 escribió:


I am trying to make a web based application which has a set of questions  
and

answers associated with it such that a report is generated based on the
answers a user chooses for each question.It's like facebook apps where we
have questions , answers and reports . Should i generate the report using
if-else ?.Please suggest a better approach.


Store all answers into a database. Then, you can make as many reports as  
you want querying the database.


--
Gabriel Genellina

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


Re: PYO versus PYC Behavior

2009-12-27 Thread Gabriel Genellina
En Thu, 24 Dec 2009 12:32:47 -0300, Boris Arloff   
escribió:


All python docs and description indicate that optimization (-OO) does  
not do much anything except the removal off pydoc. A single "O" removes  
comments and asserts, and with the removal of pydoc with double "O"  
option the *.pyo byte compile is left with pure executable code.  I am  
experiencing a different behavior than described.
 I am running Python 2.6.4 and have source code which I pre-compile  
either into pyc or pyo files depending on the optimization switch  
selected.  The pyo version fails to run with the main program module  
failing to import any other modules, such as failing on the "import os"  
statement (first line encountered).  However, the pyc version succeeds  
and runs correctly.  This is with the same code modules, same python VM  
and same machine. [...]


If you start the interpreter with "python" (no optimization), it will  
always look for .pyc files -- .pyo files are ignored.
If you start the interpreter with "python -O" or "python -OO", it will  
always look for .pyo files -- .pyc files are ignored.
Same applies for any implicit invocation, like a shebang line -- if it  
says e.g. #!/usr/env/python it will only search for .pyc files, not .pyo

Try the -v option to see which modules are loaded from where exactly.

--
Gabriel Genellina

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


Re: Difference Between Two datetimes

2009-12-27 Thread Lie Ryan

On 12/28/2009 5:42 PM, W. eWatson wrote:

You're right. Y. Works fine. The produces datetime.datetime(2009, 1, 2,
13, 1, 15).
If I now use
t2=datetime.datetime.strptime("2009/01/04 13:01:15","%Y/%m/%d %H:%M:%S")
I get tw as
datetime.datetime(2009, 1, 4, 13, 1, 15)
Then t2-t1 gives,
datetime.timedelta(2)
which is a 2 day difference--I guess. Strange.


what's strange about it? the difference between 2009/01/02 13:01:15 and 
2009/01/04 13:01:15 is indeed 2 days... Can you elaborate what do you 
mean by 'strange'?



Changing
t2=datetime.datetime.strptime("2009/01/04 14:00:30","%Y/%m/%d %H:%M:%S")
and differencing gives me,
datetime.timedelta(2, 3555), which seems to indicate a 2 day and 3555
second difference. Interesting, but I think there must be another way to
do this. Maybe not.


to do... what?
--
http://mail.python.org/mailman/listinfo/python-list


the need for 64 bits

2009-12-27 Thread Mensanator
I routinely use large numbers in my Collatz Conjecture work.

Really large. As in a quarter million bits. You wouldn't think
that the processor would make all that much difference. But
using the number is a doddle. The real trick is getting there.

There is a limitation that few encounter. In an exponential, the
exponent is limited to 32 bits, else you get an "outrageous
exponent" error. But I assume that was due to integer size,
that if you have 64 bit integers, the limit of the exponent
ought to also be 64 bits.

With my new MacBook replacing my old Windows laptop,
I can try this.

Using this function (which grows really large, really quick)...

def Type12MH(k,i):
"""Find ith, kth Generation Type [1,2] Mersenne Hailstone
   using the closed form equation

Type12MH(k,i)
k: generation
i: member of generation
returns Hailstone (a)
"""
ONE = gmpy.mpz(1)
TWO = gmpy.mpz(2)
SIX = gmpy.mpz(6)
NIN = gmpy.mpz(9)
if (k<1) or (i<1): return 0
i = gmpy.mpz(i)
k = gmpy.mpz(k)
# a = (i-1)*9**(k-1) + (9**(k-1) - 1)//2 + 1
# return 2**(6*a - 1) - 1
a = (i-ONE)*NIN**(k-ONE) + (NIN**(k-ONE) - ONE)//TWO + ONE
return TWO**(SIX*a - ONE) - ONE


i:  1   bits:  5   decimals:2
i:  2   bits: 29   decimals:9
i:  3   bits:245   decimals:   74
i:  4   bits:  2,189   decimals:  659
i:  5   bits: 19,685   decimals:5,926
i:  6   bits:177,149   decimals:   53,328
i:  7   bits:  1,594,325   decimals:  479,940
i:  8   bits: 14,348,909   decimals:4,319,453
i:  9   bits:129,140,165   decimals:   38,875,064
i: 10   bits:  1,162,261,469   decimals:  349,875,565

… my Windows/32-bit machine can't get past generation 10 without
getting "outrageous exponent".

But with a 64-bit processor, that limitation no longer stops me.

i: 11   bits: 10,460,353,205   decimals:  3,148,880,080
i: 12   bits: 94,143,178,829   decimals: 28,339,920,715

Wow! 94 billion bits! 28 billion decimal digits!

Of course, once one wall falls, you get to go up against the next
one.
For generation 13, I get:

gmp: overflow in mpz type
Abort trap

Hmm, not sure what "overflow" means in this context, but I suspect
it ran out of memory, I probably should have gotten the MacBook Pro
with 8 GB of ram. But then, maybe it wouldn't help.

Regardless, my window of research has gotten slightly larger.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Difference Between Two datetimes

2009-12-27 Thread W. eWatson

Ben Finney wrote:

"W. eWatson"  writes:


How do I get the strings into a shape that will accommodate a difference?

For example,
t1=datetime.datetime.strptime("2009/01/02 13:01:15","%y/%m/%d %H:%M:%S")
doesn't do it.
ValueError: time data did not match format:  data=2009/01/02 13:01:15
fmt=%y/%m/%d %H:%M:%S


As the error message indicates, the data input (the string) doesn't
match the specified format.

See the time format specifications at the ‘time.strftime’ documentation
http://docs.python.org/library/time.html#time.strftime>. Note
especially that ‘%y’ and ‘%Y’ are distinct.


Yes, see my response to the post above yours.
--
http://mail.python.org/mailman/listinfo/python-list


Re: Difference Between Two datetimes

2009-12-27 Thread W. eWatson
You're right. Y. Works fine. The produces datetime.datetime(2009, 1, 2, 
13, 1, 15).

If I now use
t2=datetime.datetime.strptime("2009/01/04 13:01:15","%Y/%m/%d %H:%M:%S")
I get tw as
datetime.datetime(2009, 1, 4, 13, 1, 15)
Then t2-t1 gives,
datetime.timedelta(2)
which is a 2 day difference--I guess. Strange.
Changing
t2=datetime.datetime.strptime("2009/01/04 14:00:30","%Y/%m/%d %H:%M:%S")
and differencing gives me,
datetime.timedelta(2, 3555), which seems to indicate a 2 day and 3555 
second difference. Interesting, but I think there must be another way to 
do this. Maybe not.


Roy Smith wrote:

In article ,
 "W. eWatson"  wrote:


t1=datetime.datetime.strptime("2009/01/02 13:01:15","%y/%m/%d %H:%M:%S")
doesn't do it.
ValueError: time data did not match format:  data=2009/01/02 13:01:15 
fmt=%y/%m/%d %H:%M:%S


The first thing that jumps out at me is that %y is the two-digit year.  You 
want %Y for 4-digit year.


One thing to keep in mind is that "2009/01/02 13:01:15" is ambiguous 
without a time zone.  Even if you assume that both timestamps were from the 
same location, you need to know what daylight savings rules that location 
uses, to do this right.

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


multiprocessing and threads

2009-12-27 Thread Deepak Rokade
Are there any special guidelines for using multiprocessing package and
threads in python program.

I am designing a application that works with database and files.



In my program I was spawning some threads and then some process pools.  Only
my main process use the threads and my child processes do not use any of the
threads that were copied due to fork call.



I observed that while creating the process pools some fork calls were
hanging.



I changed the sequence and then spawned process pools and then threads. This
gave me better results and none of the fork then hanged.



Is there any limitation based on sequence of threads and process ? Any
specific issues ?


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


Re: OS independent way to check if a python app is running?

2009-12-27 Thread srid
On Dec 14, 12:35 pm, MRAB  wrote:
> pyt...@bdurham.com wrote:
> > Is there an os independent way to check if a python app is running?
>
> > Goal: I have a server program based on cherrypy that I only want to have
> > running once. If a system administrator accidentally attempts to run
> > this program more than once, I would like the 2nd instance of the
> > program to detect that its already running and exit.
>
> You could use lockfile:http://pypi.python.org/pypi/lockfile/0.7
>
> If a certain file exists and is locked, then the app is already running.

How is this different from the zc.lockfile package?
http://pypi.python.org/pypi/zc.lockfile/

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


Re: Difference Between Two datetimes

2009-12-27 Thread Ben Finney
"W. eWatson"  writes:

> How do I get the strings into a shape that will accommodate a difference?
>
> For example,
> t1=datetime.datetime.strptime("2009/01/02 13:01:15","%y/%m/%d %H:%M:%S")
> doesn't do it.
> ValueError: time data did not match format:  data=2009/01/02 13:01:15
> fmt=%y/%m/%d %H:%M:%S

As the error message indicates, the data input (the string) doesn't
match the specified format.

See the time format specifications at the ‘time.strftime’ documentation
http://docs.python.org/library/time.html#time.strftime>. Note
especially that ‘%y’ and ‘%Y’ are distinct.

-- 
 \“Science doesn't work by vote and it doesn't work by |
  `\authority.” —Richard Dawkins, _Big Mistake_ (The Guardian, |
_o__)  2006-12-27) |
Ben Finney
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Difference Between Two datetimes

2009-12-27 Thread Stephen Hansen
On Sun, Dec 27, 2009 at 8:54 PM, W. eWatson  wrote:

> That's fine, but I'd like to start with two dates as strings, as
> "1961/06/16 04:35:25" and "1973/01/18 03:45:50"
>
> How do I get the strings into a shape that will accommodate a difference?
>
> For example,
> t1=datetime.datetime.strptime("2009/01/02 13:01:15","%y/%m/%d %H:%M:%S")
> doesn't do it.
> ValueError: time data did not match format:  data=2009/01/02 13:01:15
> fmt=%y/%m/%d %H:%M:%S
>

%y is a two-digit year, %Y is a four-digit year.

HTH,

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


Difference Between Two datetimes

2009-12-27 Thread W. eWatson

According to one web source, this program:

import datetime
bree = datetime.datetime(1981, 6, 16, 4, 35, 25)
nat  = datetime.datetime(1973, 1, 18, 3, 45, 50)

difference = bree - nat
print "There were", difference, "minutes between Nat and Bree"

yields:
There were 3071 days, 0:49:35 minutes between Nat and Bree

That's fine, but I'd like to start with two dates as strings, as
"1961/06/16 04:35:25" and "1973/01/18 03:45:50"

How do I get the strings into a shape that will accommodate a difference?

For example,
t1=datetime.datetime.strptime("2009/01/02 13:01:15","%y/%m/%d %H:%M:%S")
doesn't do it.
ValueError: time data did not match format:  data=2009/01/02 13:01:15 
fmt=%y/%m/%d %H:%M:%S

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


[ANN] Pyspread 0.0.13 released

2009-12-27 Thread Martin Manns
Pyspread 0.0.13 released


I am pleased to announce the new release 0.0.13 of pyspread.

 
About: 
--

Pyspread is a cross-platform Python spreadsheet application. 
It is based on and written in the programming language Python.

Instead of spreadsheet formulas, Python expressions are entered into
the spreadsheet cells. Each expression returns a Python object that can
be accessed from other cells. These objects can represent anything
including lists or matrices.

Pyspread runs on Linux and *nix platforms with GTK support as well as
on Windows (XP and Vista tested). On Mac OS X, some icons are too small
but the application basically works.


Homepage


http://pyspread.sourceforge.net


New features in 0.0.13
--

* Print framework now supports colors and drawn elements
* Splash screen removed
* Some drawing speed improvements


Bug fixes
-

+ Small white rectangle in upper left corner removed (BUG 2918360)
+ setup.py does not copy directories fixed (BUG 2913911)
+ Folder renaming to fix installation errors (BUG 2909017)


Enjoy

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


XDG Base Directory Specification

2009-12-27 Thread Lawrence D'Oliveiro
The XDG Base Directory Specification 
 seems like the best 
idea anyone’s come up with so far to end the dotfile clutter in everyone’s 
home directories.

But it needs application software to support it.

I’ve put together a very simple library for Python 
, though I know it needs a bit more 
refinement. I’ve included a sample testbed application to exercise it.

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


Re: OS independent way to check if a python app is running?

2009-12-27 Thread python
Dan,

>> Unfortunately, Windows is not a respectable OS. Unlike Unix, it allows
>> two processes to bind to the same port. The theory is that this somehow
>> allows the two processes to share their workload. One thing the OP can
>> portably do, is try to connect() to the port. If that succeeds, then a
>> server program is already running at that port, so he should exit.

> Beware of the converse, though.  If a process *cannot* connect to the 
> port, then it should *not* assume that another server *isn't* running.  
> If two potential servers both start at the same time, and each tries to 
> connect, then both will fail, but you don't want both to start, either.

Thank you for pointing out that nuance.

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


Re: OS independent way to check if a python app is running?

2009-12-27 Thread Stephen Hansen
On Sun, Dec 27, 2009 at 4:42 PM, Dan Sommers  wrote:

> On Sun, 27 Dec 2009 19:07:12 -0500, python wrote:
>
> > Hans,
> >
> >> Unfortunately, Windows is not a respectable OS. Unlike Unix, it allows
> >> two processes to bind to the same port. The theory is that this somehow
> >> allows the two processes to share their workload. One thing the OP can
> >> portably do, is try to connect() to the port. If that succeeds, then a
> >> server program is already running at that port, so he should exit.
>

In this case, I think doing it in an OS-independant way just complicates
life-- because you just gotta deal with the disrespected :) Some things are
just easier to do the way a particular OS is built, and then let the rest of
the platforms all do it another way.

Here's how we do it at the office:
if sys.platform == "win32":
from ctypes import windll
hMutex = windll.kernel32.CreateMutexA(None, 0, "COMPANY_PROGRAM_%s"
% os.environ['USERNAME'])
if windll.kernel32.GetLastError() == 183:
sys.exit()

Where COMPANY and PROGRAM are strings which make the resulting string unique
to this program. The reason I included username is in cases of people
running my app in Terminal Services / Citrix or such where multiple people
are on the machine at once-- my app is a user-app and not a server-app, so
its fine to run multiple times on the one machine, what I really wanted to
prevent was more then one user-per-machine. In your case its probably not
necessarily.

The named mutex will exist in the system indefinitely and any subsequent
attempts to create one of the same name will simply fail; and when your
program closes-- for any reason-- Windows will automatically clean up the
mutex.

Then on any other platform, the socket-binding has been a good solution for
us for this need. I never quite liked the lockfile approach due to some bad
experiences with stale-files, which isn't a problem for sockets and mutexes
as they are automatically cleaned up by the OS (at least eventually) even
after a hard and nasty crash. I don't know if Diez's approach is subject to
that at all, granted-- if its not, awesome :)

Just posting as an FYI in case its interesting in posterity.

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


Re: how to register with pypi - no such setup.py

2009-12-27 Thread Diez B. Roggisch

Phlip schrieb:

I have no alternative, to fix bugs in PyPi, _not_ in "that file", but
to continue burning up version numbers that nobody cares about. The
message is condescending because I am aware of the reason we version
packages, and the message is _not_ helping me apply that reason!


Aaand I just found the Remove button, so the complaint is down to a
misleading error message!


It's not misleading. It precisely states what's the reason for the 
denial of the request, and it's a good reason for that matter.


I agree that a kind of sandbox environment to test PyPI-packaging would 
be nice, but in lieu of that, you'll have to stick with removing & 
re-creating - or bumping up versions. Which, btw, is *not* to hard if 
you do e.g.


  0.1.1234

where 1234 is an increasing number. Just for testing.

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


Re: OS independent way to check if a python app is running?

2009-12-27 Thread Dan Sommers
On Sun, 27 Dec 2009 19:07:12 -0500, python wrote:

> Hans,
> 
>> Unfortunately, Windows is not a respectable OS. Unlike Unix, it allows
>> two processes to bind to the same port. The theory is that this somehow
>> allows the two processes to share their workload. One thing the OP can
>> portably do, is try to connect() to the port. If that succeeds, then a
>> server program is already running at that port, so he should exit.
> 
> Thank you for your tip - spot on!

Beware of the converse, though.  If a process *cannot* connect to the 
port, then it should *not* assume that another server *isn't* running.  
If two potential servers both start at the same time, and each tries to 
connect, then both will fail, but you don't want both to start, either.

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


Re: OS independent way to check if a python app is running?

2009-12-27 Thread python
Hans,

> Unfortunately, Windows is not a respectable OS. Unlike Unix, it allows two 
> processes to bind to the same port. The theory is that this somehow allows 
> the two processes to share their workload. One thing the OP can portably do, 
> is try to connect() to the port. If that succeeds, then a server program is 
> already running at that port, so he should exit.

Thank you for your tip - spot on!

Best regards,
Malcolm (OP for this thread)
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: How to iterate the input over a particular size?

2009-12-27 Thread joy99
On Dec 27, 8:42 pm, Benjamin Kaplan  wrote:
> On Sun, Dec 27, 2009 at 9:44 AM, joy99  wrote:
> > Dear Group,
>
> > I am encountering a small question.
>
> > Suppose, I write the following code,
>
> > input_string=raw_input("PRINT A STRING:")
> > string_to_word=input_string.split()
> > len_word_list=len(string_to_word)
> > if len_word_list>9:
> >             rest_words=string_to_word[9:]
> >             len_rest_word=len(rest_words)
> >             if len_rest_word>9:
> >                      remaining_words=rest_words[9:]
>
> > In this program, I am trying to extract first 9 words from an
> > indefinitely long string, until it reaches 0.
> > Am I writing it ok, or should I use while, or lambda?
> > If any one can suggest.
>
> > Hope you are enjoying a nice vacation of Merry Christmas. If any one
> > is bit free and may guide me up bit.
>
> > Wishing you a happy day ahead,
> > Best Regards,
> > Subhabrata.
> > --
>
> You want the first 9 words? string_to_word[:9]
> You want the last 9 words? string_to_word[-9:]
>
> If you want the groups of words, use a loop- that's the only way to
> get all of them for any length list.
>
>
>
> >http://mail.python.org/mailman/listinfo/python-list- Hide quoted text -
>
> - Show quoted text -- Hide quoted text -
>
> - Show quoted text -

Dear Group,
Answers were good. But I am looking for a smarter solution like:

for i[:2] in list:


etc. or by doing some looping over loop.
Do not worry I'll work out the answer.

Wishing you a happy day ahead,
Regards,
Subhabrata.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Which version of MSVC?90.DLL's to distribute with Python 2.6 based Py2exe executables?

2009-12-27 Thread Martin v. Loewis
> Thank you for your answers. From my research and testing on this topic:

Unfortunately, I can't answer these questions for py2exe. In principle,
it would hope that it is possible to include the DLLs *in* the
executable, if the py2exe mode is used where it includes all DLLs.

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


Re: A way to convert RTF to HTML?

2009-12-27 Thread Tim Wintle
On Sun, 2009-12-27 at 20:10 +, Star Glider wrote:
> the problem is that the one of the fields as text in rich text format,
> and it needs to be display without the RTF markup, of course.
> Is there any way to convert RTF to HTML?


Depending on how precisely you need to lay it out you might find it
relatively easy to do yourself (The spec is available online).

I wrote a very simple parser recently as part of a "graffle2svg" - it
ignores most styling options, but applies some of the styles in css.

http://code.google.com/p/graffle2svg/

- feel free to take rtf.py from that project under the BSD license if
it's helpful.



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


A way to convert RTF to HTML?

2009-12-27 Thread Star Glider
Hi,

I'm converting an application to Python/PyQt, one of the tasks is to
retrive data from a database and show it, no problem,
the problem is that the one of the fields as text in rich text format,
and it needs to be display without the RTF markup, of course.
Is there any way to convert RTF to HTML?

Thank you in advance.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: [wxPy] Why I can not change a ListItem property?

2009-12-27 Thread David
Il Sat, 26 Dec 2009 17:17:20 -0800, Tim Roberts ha scritto:

>>I have la ListCtrl in LC_REPORT mode and i need to change the color of a
>>single cell.
> 
> That can't be done.  In LC_REPORT mode, the whole row has to be the same
> color.  You can't change individual cells within a row.
> 
> You need an owner-draw control.  See the ListCtrl_virtual.py example, for
> instance.

Thank you for explanation. I am looking at the UltimateListCtrl class by
Andrea Gavana that allow finer control over the single cell attributes.

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


Re: How do I install GMPY 1.11 on a Mac with OS X 10.6 and Python 3.1? -SOLVED!

2009-12-27 Thread Mensanator
On Dec 27, 8:19 am, Steve Holden  wrote:
> Mensanator wrote:
> > On Dec 26, 10:02 pm, Benjamin Kaplan  wrote:
> >> On Sat, Dec 26, 2009 at 9:21 PM, Mensanator  wrote:
> >>> On Dec 26, 4:20 pm, Mensanator  wrote:
>  On Dec 26, 3:57 pm, Benjamin Kaplan  wrote:
> > On Sat, Dec 26, 2009 at 4:36 PM, Mensanator  wrote:
> >> I guess the point here is NEVER use the disk image on python.org,
> >> ALWAYS use macports to install Python 3.1.
> >> At least until python.org fixes it.
> > Have you filed a bug report on this?
>  I will.
> >>> ...NOT!
> >>> *I* won't be filling a bug report because *I* am still
> >>> locked out of python.org (it won't let me register).
> >>> Sorry, but this is beyond my control. All I can do is
> >>> report problems on comp.lang.python.
> >>> --
> >> Alright. I filed it.http://bugs.python.org/issue7580
>
> > Thank you! I would hate to see anyone else go through this hassle.
>
> >>>http://mail.python.org/mailman/listinfo/python-list
>
> Perhpas you would do me a favor and report the problem about being
> unable to register on bugs.python.org to the pydotorg webmaster list
> (pydotorg at python dot org) and let me know if you get any result.

Ok, i reported it.

>
> Please be sure to identify explicitly what the problem is and on which
> page(s) it occurs.

It wasn't any page per se, it was supposed to send an e-mail for me to
follow up the registration. I never got any e-mail.

>
> Thanks
>  Steve
> --
> Steve Holden           +1 571 484 6266   +1 800 494 3119
> PyCon is coming! Atlanta, Feb 2010  http://us.pycon.org/
> Holden Web LLC                http://www.holdenweb.com/
> UPCOMING EVENTS:        http://holdenweb.eventbrite.com/

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


Re: DB Table Processor?

2009-12-27 Thread Diez B. Roggisch

Shawn Milochik schrieb:

It sounds like you're looking for SQLAlchemy.

http://www.sqlalchemy.org/



I'd rather say he looks for Django Admin or SPROX.

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


Re: Missing collections

2009-12-27 Thread Lie Ryan

On 12/27/2009 4:53 PM, Bearophile wrote:

- frozenDict


perhaps we could extend namedtuple to become the "frozenDict"


- persistentList, persistentDict


aren't they database? Am I missing something here?


Regarding the standard library of Python 3, it's easy enough to create
for mistake a module and have it collide with an equally named module
of the std lib. To avoid this I think (after seeing the std lib of the
D language) it can be useful to put all modules of the standard
library into a namespace, like "py" or "std" or something like that.


if it were to happen, it would take python 4 or python 5 and the idea's 
runner must beat Guido down from his throne first... I think... not that 
they weren't a good idea... and other python implementations might want 
their own namespace as well to contain implementation specific modules 
(imagine "ipy", "cy", "us", "aspn", etc popping up here and there).



So you write:

import py.math
from py.math import sin

x = py.math.cos(1.2)
y = sin(1.2)

Bye,
bearophile


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


Re: DB Table Processor?

2009-12-27 Thread Shawn Milochik
It sounds like you're looking for SQLAlchemy.

http://www.sqlalchemy.org/

Enjoy!

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


DB Table Processor?

2009-12-27 Thread A. Shore
Folks, I'm considering developing a particular app in Python - I've
been working in PHP for some years now - and it will be db-intensive.
Whether it's based on sqllite or mySQL is TBD as of right now.

One tool that's done me well in the past is a generalized table
processor, which I use as a way of getting early visualization into
the app's requirements.  That is, given an existing schema, it will
generate or perform the C R U D  functions on each table comprising
the schema, with no/little code needing to be written.

I've searched without success in trying to locate some - hopefully FOS
- py-based utility that will do this for me.

Thanks for any URL/information.  AS
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: How to iterate the input over a particular size?

2009-12-27 Thread Benjamin Kaplan
On Sun, Dec 27, 2009 at 9:44 AM, joy99  wrote:
> Dear Group,
>
> I am encountering a small question.
>
> Suppose, I write the following code,
>
> input_string=raw_input("PRINT A STRING:")
> string_to_word=input_string.split()
> len_word_list=len(string_to_word)
> if len_word_list>9:
>             rest_words=string_to_word[9:]
>             len_rest_word=len(rest_words)
>             if len_rest_word>9:
>                      remaining_words=rest_words[9:]
>
>
> In this program, I am trying to extract first 9 words from an
> indefinitely long string, until it reaches 0.
> Am I writing it ok, or should I use while, or lambda?
> If any one can suggest.
>
> Hope you are enjoying a nice vacation of Merry Christmas. If any one
> is bit free and may guide me up bit.
>
> Wishing you a happy day ahead,
> Best Regards,
> Subhabrata.
> --

You want the first 9 words? string_to_word[:9]
You want the last 9 words? string_to_word[-9:]

If you want the groups of words, use a loop- that's the only way to
get all of them for any length list.

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


Re: How to iterate the input over a particular size?

2009-12-27 Thread Shawn Milochik
A couple of notes:

Your code is too packed together. That makes it hard to read. Put in some 
whitespace (and comments, where necessary), and put spaces around your equal 
signs (x = 23 instead of x=23).

That said, here's something I threw together:

#!/usr/bin/env python

def chop_list(words, size = 9):

"""
Take a list, returning values
from the end of the list, and
the original list minus those values.

>>> chop_list(['test', 'with', 'four', 'words'], 2)
(['test', 'with'], ['four', 'words'])

>>> chop_list(['test', 'with', 'four', 'words'], 3)
(['test'], ['with', 'four', 'words'])

>>> chop_list(['test', 'with', 'four', 'words'], 4)
([], ['test', 'with', 'four', 'words'])


"""

chopped = words[-size:]
old_to_return = len(words) - len(chopped)

return words[:old_to_return], chopped


if __name__ == '__main__':

import doctest
doctest.testmod()

sample_string = '''There are more than nine words here. 
I know because I wrote them.'''

word_list = sample_string.split()

while word_list:

word_list, new = chop_list(word_list)
print "Pulled off:\t%s\n\tRemaining: %s" % (new, word_list)

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


How to iterate the input over a particular size?

2009-12-27 Thread joy99
Dear Group,

I am encountering a small question.

Suppose, I write the following code,

input_string=raw_input("PRINT A STRING:")
string_to_word=input_string.split()
len_word_list=len(string_to_word)
if len_word_list>9:
 rest_words=string_to_word[9:]
 len_rest_word=len(rest_words)
 if len_rest_word>9:
  remaining_words=rest_words[9:]


In this program, I am trying to extract first 9 words from an
indefinitely long string, until it reaches 0.
Am I writing it ok, or should I use while, or lambda?
If any one can suggest.

Hope you are enjoying a nice vacation of Merry Christmas. If any one
is bit free and may guide me up bit.

Wishing you a happy day ahead,
Best Regards,
Subhabrata.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: How do I install GMPY 1.11 on a Mac with OS X 10.6 and Python 3.1? -SOLVED!

2009-12-27 Thread Steve Holden
Mensanator wrote:
> On Dec 26, 10:02 pm, Benjamin Kaplan  wrote:
>> On Sat, Dec 26, 2009 at 9:21 PM, Mensanator  wrote:
>>> On Dec 26, 4:20 pm, Mensanator  wrote:
 On Dec 26, 3:57 pm, Benjamin Kaplan  wrote:
> On Sat, Dec 26, 2009 at 4:36 PM, Mensanator  wrote:
>> I guess the point here is NEVER use the disk image on python.org,
>> ALWAYS use macports to install Python 3.1.
>> At least until python.org fixes it.
> Have you filed a bug report on this?
 I will.
>>> ...NOT!
>>> *I* won't be filling a bug report because *I* am still
>>> locked out of python.org (it won't let me register).
>>> Sorry, but this is beyond my control. All I can do is
>>> report problems on comp.lang.python.
>>> --
>> Alright. I filed it.http://bugs.python.org/issue7580
> 
> Thank you! I would hate to see anyone else go through this hassle.
> 
>>
>>
>>> http://mail.python.org/mailman/listinfo/python-list
> 
Perhpas you would do me a favor and report the problem about being
unable to register on bugs.python.org to the pydotorg webmaster list
(pydotorg at python dot org) and let me know if you get any result.

Please be sure to identify explicitly what the problem is and on which
page(s) it occurs.

Thanks
 Steve
-- 
Steve Holden   +1 571 484 6266   +1 800 494 3119
PyCon is coming! Atlanta, Feb 2010  http://us.pycon.org/
Holden Web LLC http://www.holdenweb.com/
UPCOMING EVENTS:http://holdenweb.eventbrite.com/

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


Re: Recommendation for small, fast, Python based web server

2009-12-27 Thread python
> This is a new wsgi web server implemented in a single file.
> http://code.google.com/p/web2py/source/browse/gluon/sneaky.py

Thank you Massimo.

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


Re: Which version of MSVC?90.DLL's to distribute with Python 2.6 based Py2exe executables?

2009-12-27 Thread python
Hi Martin,

> You'll need to include Microsoft.VC90.CRT.manifest and msvcr90.dll.

Thank you for your answers. From my research and testing on this topic:

1. Can I safely place these 2 files in the same folder as my Py2exe
generated EXE file or do I need to place the MSVCR90.DLL file in a
specially named sub-folder?

2. Do I need to rename the Microsoft.VC90.CRT.manifest file to
myapp.exe.manifest or can I leave it named as is?

3. Do I need to customize the contents of the
Microsoft.VC90.CRT.manifest file for my EXE?

I've been experimenting with different answers to the above questions
and multiple approaches seems to work. I suspect this is because all the
workstations I have access to for testing already have the full set of
MSVC*90.DLL's installed - and not because my multiple tests really work.

Thanks so much for your help!

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


Re: What should I use for testing a web service?

2009-12-27 Thread dusans
On Dec 27, 12:35 pm, "Diez B. Roggisch"  wrote:
> Fencer schrieb:
>
> > Hello, I need to write a test program for a web service. The web service
> > publishes its method through a wsdl-file. I recall using SOAPpy in the
> > past and as a I remember it, it was very easy to "load" the WSDL-file
> > and call web service methods. But is SOAPpy really maintained anymore?
> > Someone mentioned ZSI, but that too seems to be abadonware and my first
> > impression was it's complicated to do what was so easy in SOAPpy (at
> > least as I recall it).
> > So I guess my question is: what is a mature, actively-maintained
> > SOAP/WSDL library that is easy to use for the scenario I have (which is
> > testing an already existing service)?
>
> AFAIK the cool kids play with suds these days.
>
>    https://fedorahosted.org/suds/
>
> It certainly has a nice logo!
>
> Diez

And works very nice! Simple and very Pythonic :P
-- 
http://mail.python.org/mailman/listinfo/python-list


Python-URL! - weekly Python news and links (Dec 26)

2009-12-27 Thread Cameron Laird
QOTW:  "It took Python to make me realize that programming *could* be
fun, or at least not annoying enough to keep me from making a career
of
programming." - Aahz
   http://groups.google.com/group/comp.lang.python/msg/65ad4e71c194d97e


   Thanks to Gabriel Genellina for these references:

   How to compare dialects of csv module?
   http://groups.google.com/group/comp.lang.python/t/9de18eeabd38faff/

   Retrieve the source lines of a function:
   http://groups.google.com/group/comp.lang.python/t/a389138fbd7a5c58/

   How do classes actually work? A beginner's introduction by Steve
Holden
   http://groups.google.com/group/comp.lang.python/t/e5347d4cebc71643/

   Packages, and importing names in __init__.py explained:
   http://groups.google.com/group/comp.lang.python/t/e90896c5b607904a/

   How C++ iterators differ from Python iterators, slices and indexes:
   http://groups.google.com/group/comp.lang.python/t/22d674ee0510cd97/

   Generating random numbers in parallel isn't easy:
   http://groups.google.com/group/comp.lang.python/t/e01e0e4c7073a1e3/

   An OS independent way to check if a python app is running:
   http://groups.google.com/group/comp.lang.python/t/6e00a4ac52863bcc/

   pyZui - a Zooming User Interface:
   http://groups.google.com/group/comp.lang.python/t/c158e4ab710de96/

   The way the re module handles backslashes in replacement strings
does
   not seem natural to many:
   http://groups.google.com/group/comp.lang.python/t/61fdda4299b6a7b4/

   Comparing performance: list comprehension vs. map vs. for loop
   http://groups.google.com/group/comp.lang.python/t/791b2a041acedbc0/



Everything Python-related you want is probably one or two clicks away
in
these pages:

   Python.org's Python Language Website is the traditional
   center of Pythonia
   http://www.python.org
   Notice especially the master FAQ
   http://www.python.org/doc/FAQ.html

   PythonWare complements the digest you're reading with the
   marvelous daily python url
http://www.pythonware.com/daily

   Just beginning with Python?  This page is a great place to start:
   http://wiki.python.org/moin/BeginnersGuide/Programmers

   The Python Papers aims to publish "the efforts of Python
enthusiasts":
   http://pythonpapers.org/
   The Python Magazine is a technical monthly devoted to Python:
   http://pythonmagazine.com

   Readers have recommended the "Planet" site:
   http://planet.python.org

   comp.lang.python.announce announces new Python software.  Be
   sure to scan this newsgroup weekly.
   http://groups.google.com/group/comp.lang.python.announce/topics

   Python411 indexes "podcasts ... to help people learn Python ..."
   Updates appear more-than-weekly:
   http://www.awaretek.com/python/index.html

   The Python Package Index catalogues packages.
   http://www.python.org/pypi/

   Much of Python's real work takes place on Special-Interest Group
   mailing lists
   http://www.python.org/sigs/

   Python Success Stories--from air-traffic control to on-line
   match-making--can inspire you or decision-makers to whom you're
   subject with a vision of what the language makes practical.
   http://www.pythonology.com/success

   The Python Software Foundation (PSF) has replaced the Python
   Consortium as an independent nexus of activity.  It has official
   responsibility for Python's development and maintenance.
   http://www.python.org/psf/
   Among the ways you can support PSF is with a donation.
   http://www.python.org/psf/donations/

   The Summary of Python Tracker Issues is an automatically generated
   report summarizing new bugs, closed ones, and patch submissions.
   
http://search.gmane.org/?author=status%40bugs.python.org&group=gmane.comp.python.devel&sort=date

   Although unmaintained since 2002, the Cetus collection of Python
   hyperlinks retains a few gems.
   http://www.cetus-links.org/oo_python.html

   Python FAQTS
   http://python.faqts.com/

   The Cookbook is a collaborative effort to capture useful and
   interesting recipes.
   http://code.activestate.com/recipes/langs/python/

   Many Python conferences around the world are in preparation.
   Watch this space for links to them.

   Among several Python-oriented RSS/RDF feeds available, see:
   http://www.python.org/channews.rdf
   For more, see:
   http://www.syndic8.com/feedlist.php?ShowMatch=python&ShowStatus=all
   The old Python "To-Do List" now lives principally in a
   SourceForge reincarnation.
   http://sourceforge.net/tracker/?atid=355470&group_id=5470&func=browse
   http://www.python.org/dev/peps/pep-0042/

   del.icio.us presents an intriguing approach to reference
commentary.
   It already aggregates quite a bit of Python intelligence.
   http://del.icio.us/tag/python

   Enjoy the *Python Magazine*.
   http://pymag.phparch.c

Re: Missing Images

2009-12-27 Thread Victor Subervi
On Sat, Dec 26, 2009 at 4:52 PM, Carsten Haese wrote:

> Victor Subervi wrote:
> > Right. Thank you again. I'd forgotten to put in
> > enctype="multipart/form-data". Now I have the following snipped:
> >
> >   for pic in ourPics:
> > sql = 'update %s set pic%d=%s where ID="%s";' % (store, i,
> > (MySQLdb.Binary(pic),), id)
> > print sql
> > #cursor.execute(sql)
>
> This binds the name <> to a string containing an "update" statement...
>

> > Which prints to screen the following:
> >
> > insert into products (SKU, Category, Name, Title, Description, Price,
> > SortFactor, Availability, OutOfStock, ShipFlatFee, ShipPercentPrice,
> > ShipPercentWeight, Associations, TempPrice, LastDatePrice, Weight,
> > Metal, PercentMetal, pic0, pic1, sizes, colorsShadesNumbersShort)
> > values("prodSKU1", "prodCat1", "name1", "title1", "descr", "12.34",
> > "500", "1", "0", "10.00", "5", "2", "", "1", "2000-01-01", "2.5", "",
> > "20", "� JFIF�   �H�H
>
> ...and that's an "insert" statement, so that's clearly not the output
> from the code you posted above.
>

Oops. The update and insert are the same with regard to the problem at hand,
but how were you to know? Sorry <:-}



>
> > and a bunch more binary data. This fails on insert. If I recall
> > correctly, I need to convert that binary data into something like (c,
> > array(... How do I do that? I'll include all code below in case it's
> > necessary.
>
> You have been told many, many times before, by myself and others, not to
> embed values directly into the query string. Use parameter binding to
> transmit the values to the database. I'm sure you'll find an old post of
> mine somewhere in the archives of this list in which I showed you how to
> do that.
>

Thank you. Now I remember. Thank you for your patience, Carsten. I don't
know why I'm so dense! At least I can laugh at myself :/
beno
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: What should I use for testing a web service?

2009-12-27 Thread Diez B. Roggisch

Fencer schrieb:
Hello, I need to write a test program for a web service. The web service 
publishes its method through a wsdl-file. I recall using SOAPpy in the 
past and as a I remember it, it was very easy to "load" the WSDL-file 
and call web service methods. But is SOAPpy really maintained anymore? 
Someone mentioned ZSI, but that too seems to be abadonware and my first 
impression was it's complicated to do what was so easy in SOAPpy (at 
least as I recall it).
So I guess my question is: what is a mature, actively-maintained 
SOAP/WSDL library that is easy to use for the scenario I have (which is 
testing an already existing service)?


AFAIK the cool kids play with suds these days.

  https://fedorahosted.org/suds/

It certainly has a nice logo!

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


Re: Missing collections

2009-12-27 Thread Arnaud Delobelle
On Dec 27, 5:53 am, Bearophile  wrote:
> What are the useful collections that are missing in the collections
> module?
>
> Let's see:
> - sortedDict, sortedSet (based on a search tree)

There was a thread on these two on python-ideas:

http://mail.python.org/pipermail/python-ideas/2009-July/005219.html

The OP implemented both:

http://code.google.com/p/python-data-structures/

[...]

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


What should I use for testing a web service?

2009-12-27 Thread Fencer
Hello, I need to write a test program for a web service. The web service 
publishes its method through a wsdl-file. I recall using SOAPpy in the 
past and as a I remember it, it was very easy to "load" the WSDL-file 
and call web service methods. But is SOAPpy really maintained anymore? 
Someone mentioned ZSI, but that too seems to be abadonware and my first 
impression was it's complicated to do what was so easy in SOAPpy (at 
least as I recall it).
So I guess my question is: what is a mature, actively-maintained 
SOAP/WSDL library that is easy to use for the scenario I have (which is 
testing an already existing service)?


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


Re: Simple distributed example for learning purposes?

2009-12-27 Thread Shawn Milochik
The special features of the Shrek DVD showed how the rendering took so much 
processing power that everyone's workstation was used overnight as a rendering 
farm. Some kind of video rendering would make a great example. However, it 
might be a lot of overhead for you to set up, unless you can find someone with 
expertise in the area. The nice thing about this is that it would be relevant 
to the audience. Also, if you describe what goes into processing a single frame 
in enough depth that they appreciate it, they'll really "get" the power of 
distributed processing.

Something else incredibly time-expensive but much easier to set up would be 
matching of names and addresses. I worked at a company where this was, at its 
very core, the primary function of the business model. Considering the 
different ways of entering simple data, many comparisons must be made. This 
takes a lot of time, and even then the match rates aren't necessarily going to 
be very high.

Here are some problems with matching:

Bill versus William
'52 10th Street' | '52 tenth street'
'E. Smith street' | 'E smith street' | 'east smith street'
'Bill Smith' | 'Smith, Bill' 
'William Smith Jr' | 'William Smith Junior'
'Dr. W. Smith' | 'William Smith'
'Michael Norman Smith' | 'Michael N. Smith' | 'Michael Smith' | 'Smith, 
Michael' | 'Smith, Michael N.' | 'Smith, Michael Norman'

The list goes on and on, ad nauseum. Not to mention geocoding, married and 
maiden names, and scoring partial name matches with distance proximity matches. 
Another nice thing is that, depending on how much time you want to spend on it, 
you can have the students refine the matching rules over time, and see how 
those rules effect the match rate and the processing time. On the downside, 
your class will not have the joy of being taught the 'ideal solution' to this 
problem at the end; if you come up with that, you'll be able to go into 
business and make millions of dollars a year. ^_^

Shawn




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