[ANN] Pyspread 0.0.14b released

2010-03-13 Thread Martin Manns
Pyspread 0.0.14b released
=

I am pleased to announce the new release 0.0.14b 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


 * Cell border can be changed independently.
 * Cell access allows negative indices when not slicing.


Enjoy

Martin

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

Support the Python Software Foundation:
http://www.python.org/psf/donations/


Re: question regarding wxSlider

2010-03-13 Thread Ugo Cupcic
Hi Philip,

Thanks for your redirection. I'll try with them :)

Cheers,

Ugo

PS : yes developing  a robotic hand is really fun :D

On Fri, Mar 12, 2010 at 7:08 PM, Philip Semanchuk phi...@semanchuk.comwrote:

 On Mar 12, 2010, at 1:56 PM, Ugo Cupcic wrote:

  Hi all,

 I have a question regarding wxSlider. I'm developing a wxwidget python
 interface for a robotic hand. The sliders send the target values to the
 joints.

 I'd like to display the current position of the joint on the slider. I
 wanted to use wxSlider.SetTick(myposition) but I couldn't get SetTick to
 display anything.

 Anyone has an idea ? I attached a dummy code to the message to illustrate.



 Hi Ugo,
 I don't mean to chase you away, but there is a dedicated wxPython mailing
 list where you obviously have a much better chance of getting an answer.

 http://www.wxpython.org/maillist.php

 Developing a robotic hand sounds like fun!

 Cheers
 Philip




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




-- 
  Ugo Cupcic
http://www.genugo.com/ugocupcic
   _
  ' v '
/  \
 m m
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: execute bash builtins in python

2010-03-13 Thread alex goretoy
I found this to be even better; maybe someone will find this useful, who
knows.
just export PS1, duh
Popen([bash -c 'export PS1='python'; source
$HOME/.bashrc;alias'],shell=True,stdout=PIPE).stdout.read()

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


Python for newbies (Pythno users group in Macedonia)

2010-03-13 Thread Дамјан Георгиевски
Hi all,
we are starting with bi-monthly Python User Group meetings in Skopje, 
Macedonia. The meetings are targeted for both beginners and more 
experienced users.

The basic idea is to have an 1 hour presentation at the start for the 
beginners and an 1 hour ad-hoc discussion about projects, applications, 
interesting stuff etc.

I'd like to gather some guidance/experince/thoughts about some beginner 
oriented python lectures we could use?

My first idea was to do something like the Python module of the Week, 
but maybe there's a better approach?

thanks

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


Re: python to exe

2010-03-13 Thread Gib Bogle

Steven D'Aprano wrote:

As the old proverb goes: give a man a fish, and you feed him for a day. 
Teach him how to fish, and he has food forever.


I like this version:

Light a man a fire, and you keep him warm for hours.  Set a man on fire, and you 
keep him warm for the rest of his life.


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


Re: python to exe

2010-03-13 Thread Alf P. Steinbach

* Gib Bogle:

Steven D'Aprano wrote:

As the old proverb goes: give a man a fish, and you feed him for a 
day. Teach him how to fish, and he has food forever.


I like this version:

Light a man a fire, and you keep him warm for hours.  Set a man on fire, 
and you keep him warm for the rest of his life.


;-)


Hey! I was going to post that! And there it was, in the next article... :-)

Cheers,

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


Re: python to exe

2010-03-13 Thread Mark Lawrence

Gib Bogle wrote:

Steven D'Aprano wrote:

As the old proverb goes: give a man a fish, and you feed him for a 
day. Teach him how to fish, and he has food forever.


I like this version:

Light a man a fire, and you keep him warm for hours.  Set a man on fire, 
and you keep him warm for the rest of his life.


;-)


I'm certain that members of the Guinea Pig Club might have something to 
say on that one, see :-

http://en.wikipedia.org/wiki/Guinea_Pig_Club

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


Re: to create variable from dict

2010-03-13 Thread Andreas Waldenburger
On Fri, 12 Mar 2010 06:50:18 -0800 (PST) Luis M. González
luis...@gmail.com wrote:

 The question is: should you do it?

And the answer is: No.

And the usual disclaimer is: (Unless you *know* it's the best possible
solution to your problem.)

/W

-- 
INVALID? DE!

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


Re: execute bash builtins in python

2010-03-13 Thread Steve Holden
alex goretoy wrote:
 I found this to be even better; maybe someone will find this useful, who
 knows.
 just export PS1, duh
 Popen([bash -c 'export PS1='python'; source
 $HOME/.bashrc;alias'],shell=True,stdout=PIPE).stdout.read()
 
Try using an interactive shell:

 from subprocess import *
 p1 = Popen(bash -i -c alias, stdout=PIPE, shell=True)
 p1.stdout.read()
alias ls='ls --color=auto'\n


regards
 Steve
-- 
Steve Holden   +1 571 484 6266   +1 800 494 3119
See PyCon Talks from Atlanta 2010  http://pycon.blip.tv/
Holden Web LLC http://www.holdenweb.com/
UPCOMING EVENTS:http://holdenweb.eventbrite.com/

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


Re: python to exe

2010-03-13 Thread Steve Holden
Gib Bogle wrote:
 Steven D'Aprano wrote:
 
 As the old proverb goes: give a man a fish, and you feed him for a
 day. Teach him how to fish, and he has food forever.
 
 I like this version:
 
 Light a man a fire, and you keep him warm for hours.  Set a man on fire,
 and you keep him warm for the rest of his life.
 
 ;-)

I like Give a man a fish, and he eats for a day. Teach a man to fish
and he will bore you with stories of the one that got away for the rest
of his life.

regards
 Steve
-- 
Steve Holden   +1 571 484 6266   +1 800 494 3119
See PyCon Talks from Atlanta 2010  http://pycon.blip.tv/
Holden Web LLC http://www.holdenweb.com/
UPCOMING EVENTS:http://holdenweb.eventbrite.com/

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


print formatting

2010-03-13 Thread vsoler
Hello,

My script contains a print statement:

 print '%40s %15d' % (k, m)

However,

 1- the string is right adjusted, and I would like it left
adjusted
 2- the number is a decimal number, and I would like it with
the thousands separator and 2 decimals

If possible, the thousands separator and the decimal separator should
use my local settings.

Is there any way to achieve this?
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: python to exe

2010-03-13 Thread Steve Holden
John Bokma wrote:
 Gabriel Genellina gagsl-...@yahoo.com.ar writes:
 
 On 13 mar, 00:26, Robin rob...@cnsp.com wrote:

 Does anyone know of a good python to stand alone exe compiler?
 http://tinyurl.com/...
 
 Wow, pathetic fuck. You don't have to post you know.
 
And you don't have to give Google a second chance at indexing the URL,
but we all make mistakes.

regards
 Steve
-- 
Steve Holden   +1 571 484 6266   +1 800 494 3119
See PyCon Talks from Atlanta 2010  http://pycon.blip.tv/
Holden Web LLC http://www.holdenweb.com/
UPCOMING EVENTS:http://holdenweb.eventbrite.com/

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


Re: Python for newbies (Pythno users group in Macedonia)

2010-03-13 Thread Steve Holden
Дамјан Георгиевски wrote:
 Hi all,
 we are starting with bi-monthly Python User Group meetings in Skopje, 
 Macedonia. The meetings are targeted for both beginners and more 
 experienced users.
 
 The basic idea is to have an 1 hour presentation at the start for the 
 beginners and an 1 hour ad-hoc discussion about projects, applications, 
 interesting stuff etc.
 
 I'd like to gather some guidance/experince/thoughts about some beginner 
 oriented python lectures we could use?
 
 My first idea was to do something like the Python module of the Week, 
 but maybe there's a better approach?
 
 thanks
 
If you are all English-speakers then perhaps you could consider showing
a PyCon video - see

  http://pycon.blip.tv

Good luck with the group. I hope to see PyCon Macedonia emerging before
too long!

regards
 Steve
-- 
Steve Holden   +1 571 484 6266   +1 800 494 3119
See PyCon Talks from Atlanta 2010  http://pycon.blip.tv/
Holden Web LLC http://www.holdenweb.com/
UPCOMING EVENTS:http://holdenweb.eventbrite.com/

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


Re: print formatting

2010-03-13 Thread Steve Holden
vsoler wrote:
 Hello,
 
 My script contains a print statement:
 
  print '%40s %15d' % (k, m)
 
 However,
 
  1- the string is right adjusted, and I would like it left
 adjusted
  2- the number is a decimal number, and I would like it with
 the thousands separator and 2 decimals
 
 If possible, the thousands separator and the decimal separator should
 use my local settings.
 
 Is there any way to achieve this?

Left-alignment is achieved by using a negative width.

You can use the locale module to generate thousands-separated numeric
string representations:

 from locale import *
 setlocale(LC_ALL, '') # locale is otherwise 'C'
'en_US.UTF-8'
 locale.format(%12.3f, 123456.789, grouping=False)
'  123456.789'
 locale.format(%12.3f, 123456.789, grouping=True)
' 123,456.789'

regards
 Steve
-- 
Steve Holden   +1 571 484 6266   +1 800 494 3119
See PyCon Talks from Atlanta 2010  http://pycon.blip.tv/
Holden Web LLC http://www.holdenweb.com/
UPCOMING EVENTS:http://holdenweb.eventbrite.com/

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


Re: print formatting

2010-03-13 Thread Peter Otten
vsoler wrote:

 My script contains a print statement:
 
  print '%40s %15d' % (k, m)
 
 However,
 
  1- the string is right adjusted, and I would like it left
 adjusted
  2- the number is a decimal number, and I would like it with
 the thousands separator and 2 decimals
 
 If possible, the thousands separator and the decimal separator should
 use my local settings.
 
 Is there any way to achieve this?

 import locale
 locale.setlocale(locale.LC_ALL, )
'de_DE.UTF-8'

Traditional:
 print '%-40s|%15s' % (k, locale.format(%d, m, grouping=True))
hello   |  1.234.567

New:
 {0:40} {1:15n}.format(k, m)
'hello  1.234.567'

See also:
http://docs.python.org/dev/py3k/library/string.html#formatstrings

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


Re: python to exe

2010-03-13 Thread python
Robin,

 do you of an alternate compilter it doesn't work (py2exe) on my windows 7 box

I can assure you that Py2exe does work on Windows 7 (my firm develops
commercial Python applications packaged using Py2exe running on Windows
7), but it does take a bit of fiddling and some patience. Join the
py2exe newsgroup and post your problems there.
https://lists.sourceforge.net/lists/listinfo/py2exe-users

You may also want to google 'Gui2exe'. This is a free front-end to
Py2exe that you can use to generate your Py2exe setup.py scripts. Note
that Gui2exe requires wxPython (free) to run.

Finally, make sure you are trying to compile 32-bit Python 2.x code. I
don't think py2exe supports Python 3.x or 64-bit versions of Python yet.

 Nope; py2exe is pretty much the go-to tool for this.

I hear great things about PyInstaller. The project is not dead - make
sure you use the latest version in the SVN.

Search stackoverflow.com for positive feedback and tips on PyInstaller.
Its on our plate to take a good look this product 'one of these days'.

Good luck!

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


Re: Question about typing: ints/floats

2010-03-13 Thread Albert van der Horst
In article mailman.266.1267666113.23598.python-l...@python.org,
MRAB  pyt...@mrabarnett.plus.com wrote:
Zeeshan Quireshi wrote:
 On Mar 3, 6:45 pm, Wells thewellsoli...@gmail.com wrote:
 This seems sort of odd to me:

 a = 1
 a += 1.202
 a
 2.202

 Indicates that 'a' was an int that was implicitly casted to a float.
 But:

 a = 1
 b = 3
 a / b
 0

 This does not implicitly do the casting, it treats 'a' and 'b' as
 integers, and the result as well. Changing 'b' to 3.0 will yield a
 float as a result (0.1)

 Is there some way to explain the consistency here? Does python
 implicitly change the casting when you add variables of a different
 numeric type?

 Anyway, just  curiosity more than anything else. Thanks!

 Python, like most other languages performs only integer division when
 both the operands are ints. So only if one of the types is a flot or
 you explicitly cast your expression to be a double, then the value
 will be a fraction. otherwise you will the quotient.

int + int gives int
float + float gives float
int + float gives float

You skip a step here that the OP may have missed.
a = 1
a += 1.222
This invokes the calculation
1 + 1.222
which is int + float.

Groetjes Albert

--
-- 
Albert van der Horst, UTRECHT,THE NETHERLANDS
Economic growth -- being exponential -- ultimately falters.
alb...@spearc.xs4all.nl =n http://home.hccnet.nl/a.w.m.van.der.horst

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


Re: Reverse engineering CRC?

2010-03-13 Thread Albert van der Horst
In article 7vj7fdfnn...@mid.individual.net,
Gregory Ewing  greg.ew...@canterbury.ac.nz wrote:
Given some known data/crc pairs, how feasible is it to
figure out the polynomial being used to generate the crc?

In the case I'm looking at, it appears that the crc
size may be at least 24 bits, so just trying all possible
polynomials probably isn't doable.

An article I found hints at the possibility of using
GCDs to make the search more efficient, but doesn't go
into any details. Anyone know of any literature about
this?

If it helps, I have the ability to generate test cases
with known message contents to some extent, although
I don't have complete control over the contents. Also
it's a manual process, so generating large numbers of
them automatically isn't an option.

If it is really a CRC, it is doable.

You can have an indication, if the intention is to detect
machine errors (transmission or disk errors) or they want
you to prevent tampering with the file.
In the latter case it may be a one-way hash. Then it is near
impossible, as this is the design criterion for a one-way hash.

--
Greg

Groetjes Albert

--
-- 
Albert van der Horst, UTRECHT,THE NETHERLANDS
Economic growth -- being exponential -- ultimately falters.
alb...@spearc.xs4all.nl =n http://home.hccnet.nl/a.w.m.van.der.horst

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


Use python and Jython together? (newbie)

2010-03-13 Thread Karjer Jdfjdf
I'm pretty new at programming and want some advice on mixing Jython and Python.

I want to use Jython to access some Java libraries, but I want to keep 
developing in normal Python. Some modules I use a lot are not available in 
Jython.

The bulk of my programming is in Python but I want to use Java 2D libraries for 
graphical presentation of data generated in normal Python. Is it possible that 
I generate data in Python and then pass it through to a Jython program to 
visualise the data.



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


building a dict

2010-03-13 Thread vsoler
Say that m is a tuple of 2-tuples

m=(('as',3), ('ab',5), (None, 1), ('as',None), ('as',6))

and I need to build a d dict where each key has an associated list
whose first element is the count, and the second is the sum. If a 2-
tuple contains a None value, it should be discarded.

The expected result is:
d={'as':[2, 9], 'ab': [1,5]}

How should I proceed? So far I have been unsuccessful. I have tried
with a for loop.

Thank you for your help
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Use python and Jython together? (newbie)

2010-03-13 Thread Christian Heimes
Karjer Jdfjdf wrote:
 I'm pretty new at programming and want some advice on mixing Jython and 
 Python.
 
 I want to use Jython to access some Java libraries, but I want to keep 
 developing in normal Python. Some modules I use a lot are not available in 
 Jython.
 
 The bulk of my programming is in Python but I want to use Java 2D libraries 
 for graphical presentation of data generated in normal Python. Is it possible 
 that I generate data in Python and then pass it through to a Jython program 
 to visualise the data.

You can't mix Jython and Python in one program. But you can use other
means to create bindings for Java code. JCC
(http://pypi.python.org/pypi/JCC/2.5.1) is a very powerful code
generator for CPython.

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


Re: building a dict

2010-03-13 Thread Jon Clements
On 13 Mar, 15:05, vsoler vicente.so...@gmail.com wrote:
 Say that m is a tuple of 2-tuples

 m=(('as',3), ('ab',5), (None, 1), ('as',None), ('as',6))

 and I need to build a d dict where each key has an associated list
 whose first element is the count, and the second is the sum. If a 2-
 tuple contains a None value, it should be discarded.

 The expected result is:
 d={'as':[2, 9], 'ab': [1,5]}

 How should I proceed? So far I have been unsuccessful. I have tried
 with a for loop.

 Thank you for your help

Something like:

d = defaultdict( lambda: [0,0] )
for key, val in filter(lambda L: not any(i is None for i in L), m):
d[key][0] += 1
d[key][1] += val

hth

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


Re: building a dict

2010-03-13 Thread Patrick Maupin
On Mar 13, 9:05 am, vsoler vicente.so...@gmail.com wrote:
 Say that m is a tuple of 2-tuples

 m=(('as',3), ('ab',5), (None, 1), ('as',None), ('as',6))

 and I need to build a d dict where each key has an associated list
 whose first element is the count, and the second is the sum. If a 2-
 tuple contains a None value, it should be discarded.

 The expected result is:
 d={'as':[2, 9], 'ab': [1,5]}

 How should I proceed? So far I have been unsuccessful. I have tried
 with a for loop.

Post your first try at a for loop, and people might be willing to
point out problems, but this is such a basic for loop that it is
unlikely that anybody is going to write your ENTIRE homework for you.

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


Re: building a dict

2010-03-13 Thread Steve Holden
vsoler wrote:
 Say that m is a tuple of 2-tuples
 
 m=(('as',3), ('ab',5), (None, 1), ('as',None), ('as',6))
 
 and I need to build a d dict where each key has an associated list
 whose first element is the count, and the second is the sum. If a 2-
 tuple contains a None value, it should be discarded.
 
 The expected result is:
 d={'as':[2, 9], 'ab': [1,5]}
 
 How should I proceed? So far I have been unsuccessful. I have tried
 with a for loop.
 
 Thank you for your help

Here's a fairly simple-minded approach using a defaultdict, which calls
the dflt() function to create a value when the key is absent.

 from collections import defaultdict
 def dflt():
... return [0, 0]
...
 m = (('as',3), ('ab',5), (None, 1), ('as',None), ('as',6))
 d = defaultdict(dflt)
 for key, n in m:
...   if key is not None and n is not None:
... c, t = d[key]
... d[key] = [c+1, t+n]
...
 d
defaultdict(function dflt at 0x7f0bcb1b0ed8,
{'as': [2, 9], 'ab': [1, 5]})


regards
 Steve
-- 
Steve Holden   +1 571 484 6266   +1 800 494 3119
See PyCon Talks from Atlanta 2010  http://pycon.blip.tv/
Holden Web LLC http://www.holdenweb.com/
UPCOMING EVENTS:http://holdenweb.eventbrite.com/

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


Re: Ideas for creating processes

2010-03-13 Thread Piet van Oostrum
 J dreadpiratej...@gmail.com (J) wrote:

J And now I'm looking at subprocess and I can set shell=True and it will
J intrepret special characters like 

J So could I do something like this:

J for item in pathlist:
J subprocess.Popen('rsync command ', shell=True)

J and simply wait unti they are all done?

Using shell=True is often the wrong thing to do. And certainly just to
get a process to run in the background. subprocess will run them in the
background by default. Besides if you do it in the way you propose you
can't wait for them. You can only wait for the shell that starts the
rsync, but that will be finished almost immediately.

 import subprocess
 p = subprocess.Popen('sleep 1000 ', shell=True)
 p.wait()
0

The wait() returns immediately.
-- 
Piet van Oostrum p...@vanoostrum.org
WWW: http://pietvanoostrum.com/
PGP key: [8DAE142BE17999C4]
Nu Fair Trade woonaccessoires op http://www.zylja.com
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: building a dict

2010-03-13 Thread Jon Clements
On 13 Mar, 15:28, Patrick Maupin pmau...@gmail.com wrote:
 On Mar 13, 9:05 am, vsoler vicente.so...@gmail.com wrote:

  Say that m is a tuple of 2-tuples

  m=(('as',3), ('ab',5), (None, 1), ('as',None), ('as',6))

  and I need to build a d dict where each key has an associated list
  whose first element is the count, and the second is the sum. If a 2-
  tuple contains a None value, it should be discarded.

  The expected result is:
  d={'as':[2, 9], 'ab': [1,5]}

  How should I proceed? So far I have been unsuccessful. I have tried
  with a for loop.

 Post your first try at a for loop, and people might be willing to
 point out problems, but this is such a basic for loop that it is
 unlikely that anybody is going to write your ENTIRE homework for you.

 Regards,
 Pat

I was thinking it's possibly homework, but looking at previous posts
it's fairly unlikely.

(If it is, then mea culpa, but as Steve has replied, I think I'll
manage to sleep tonight not worrying about the influx of uneducated,
incompetent and otherwise useless developers to the market).

However, they're receiving some 'elegant' solutions which no professor
(unless they're a star pupil - in which case they wouldn't be asking)
would take as having been done by their selves.
(Or at least I hope not)

But yes, I would certainly be interested in the 'unsuccessful
attempt'.
(To the OP, do post your attempts, it does give more validity).


Cheers,

Jon.

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


Work at Home - Earn 50, 000 Weekly Without Investment Its Not A Fake, 100% Earning Guarantee

2010-03-13 Thread earner
Work at Home - Earn 50,000 Weekly Without Investment Its Not A Fake,
100% Earning   Guarantee

For Register Click Here To Register Now - Start Earning Instantly!

http://www.cash-world.myfortuneincome.com
http://www.cash-world.myfortuneincome.com
http://www.cash-world.myfortuneincome.com
http://www.cash-world.myfortuneincome.com
http://www.cash-world.myfortuneincome.com
http://www.cash-world.myfortuneincome.com
http://www.cash-world.myfortuneincome.com
-- 
http://mail.python.org/mailman/listinfo/python-list


wx error, I suspect my class

2010-03-13 Thread Alex Hall
Hello all,
I am trying to make a gui out of xrc and wxpython, but I think my
understanding of Python's class/method structure is causing problems.
The below code returns an error on the line
  panel=xrc.XRCCTRL(mf, dl)
The error goes back to wxPython itself and says attribute error:
'none' type object has no attribute 'FindWindowById'
Here is my complete code:

import wx
from wx import xrc

class myapp(wx.App):
 def OnInit(self):
  #load the xrc file
  res=xrc.XmlResource('dictionary.xrc')

  #load the frame containing everything else
  mf=res.LoadFrame(None, mainframe)

  #assign all necessary controls to variables (text boxes and buttons)
for easier binding
  #format: varName=xrc.XRCCTRL(parent, IDFromXRCFile)
  panel=xrc.XRCCTRL(mf, dl)
  btn_go=xrc.XRCCTRL(panel, btn_go)
  btn_close=xrc.XRCCTRL(panel, btn_close)

  #now bind the gui controls to functions
  mf.Bind(wx.EVT_BUTTON, close, id=xrc.XRCID(btn_close))
  mf.Show()
 #end def OnInit

 def close(self):
  mf.Close(True)
 #end def close
#end class myapp

win=myapp(False)
win.MainLoop()

That is all there is to it. I made the xrc file with XRCed, so I know
it is properly formatted. I always see Python methods and classes
using the self keyword, but I never understood why or when to/not to
use it. I probably need it in the above code, but I am not sure how to
insert it correctly. I have been fighting with this code for the last
two days with no progress, so I would greatly appreciate any help you
can provide. Thanks.


-- 
Have a great day,
Alex (msg sent from GMail website)
mehg...@gmail.com; http://www.facebook.com/mehgcap
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: building a dict

2010-03-13 Thread rurpy
On Mar 13, 8:28 am, Patrick Maupin pmau...@gmail.com wrote:
 On Mar 13, 9:05 am, vsoler vicente.so...@gmail.com wrote:

  Say that m is a tuple of 2-tuples

  m=(('as',3), ('ab',5), (None, 1), ('as',None), ('as',6))

  and I need to build a d dict where each key has an associated list
  whose first element is the count, and the second is the sum. If a 2-
  tuple contains a None value, it should be discarded.

  The expected result is:
  d={'as':[2, 9], 'ab': [1,5]}

  How should I proceed? So far I have been unsuccessful. I have tried
  with a for loop.

 Post your first try at a for loop, and people might be willing to
 point out problems, but this is such a basic for loop that it is
 unlikely that anybody is going to write your ENTIRE homework for you.

This is probably what you (OP) were trying to come up with?
[untested]

d = {}
for item in m:
key = m[0];  value = m[1]
if key is None or value is None: continue
if key not in dict:
d[key] = [value]
else:
d[key].append (value)

You can replace the
  for item in m:
  key = m[0];  value = m[1]
above with
  for key, value in m:
which is a little nicer.

However, as other responses point out, when you want
to accumulate results in a dict, collections.defaultdict
should pop into your mind first.
-- 
http://mail.python.org/mailman/listinfo/python-list


Decorator to inject function into __call__ of a class

2010-03-13 Thread Jon Clements
This is semi-experimental and I'd appreciate opinions of whether it's
the correct design approach or not. It seems like a good idea, but it
doesn't mean it is.

I have a class 'A', this provides standard support functions and
exception handling.
I have 'B' and 'C' which specialise upon 'A'

What I'd like to achieve is something similar to:

@inject(B):
 def some_function(a, b):
 pass # something useful

The name 'some_function' is completely redundant -- don't need it,
don't actually care about the function afterwards, as long as it
becomes a __call__ of a 'B' *instance*.

I've basically got a huge list of functions, which need to be the
callable method of an object, and possibly at run-time, so I don't
want to do:

class Something(B):
def __call__(self, etc.. etc...):
 pass # do something

I've got as far as type(somename, (B,), {}) -- do I then __init__ or
__new__ the object or...

In short, the function should be the __call__ method of an object that
is already __init__'d with the function arguments -- so that when the
object is called, I get the result of the the function (based on the
objects values).

Hope that makes sense,

Cheers,

Jon.






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


Some PyCon videos won't play

2010-03-13 Thread Lee Harr

I am having a great time watching videos from PyCon. Thanks to
everyone who presented, and to those who did such a great job
putting the videos up at: http://pycon.blip.tv/

My trouble is that, although most of the videos play perfectly,
there are a few that refuse to play at all. Like:

Python 101
http://pycon.blip.tv/file/3322312/

Using Python to Create Robotic Simulations for Planetary Exploration
http://pycon.blip.tv/file/3332780/

Saturday Morning Lightning talks
http://pycon.blip.tv/file/3264041/


Is anyone else having trouble with these?

  
_
Your E-mail and More On-the-Go. Get Windows Live Hotmail Free.
https://signup.live.com/signup.aspx?id=60969
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Decorator to inject function into __call__ of a class

2010-03-13 Thread Patrick Maupin
On Mar 13, 10:19 am, Jon Clements jon...@googlemail.com wrote:

 What I'd like to achieve is something similar to:

 @inject(B):
  def some_function(a, b):
      pass # something useful

So, just typing at the keyboard here, you mean something like:

class InjectClass(object):
def __init__(self, func, *args, **kw):
self.func = func
self.args = args
self.kw = kw
def __call__(self):
self.func(*self.args, **self.kw)

Or exactly what are you looking for?

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


Re: building a dict

2010-03-13 Thread rurpy
On Mar 13, 9:13 am, ru...@yahoo.com wrote:
 On Mar 13, 8:28 am, Patrick Maupin pmau...@gmail.com wrote:



  On Mar 13, 9:05 am, vsoler vicente.so...@gmail.com wrote:

   Say that m is a tuple of 2-tuples

   m=(('as',3), ('ab',5), (None, 1), ('as',None), ('as',6))

   and I need to build a d dict where each key has an associated list
   whose first element is the count, and the second is the sum. If a 2-
   tuple contains a None value, it should be discarded.

   The expected result is:
   d={'as':[2, 9], 'ab': [1,5]}

   How should I proceed? So far I have been unsuccessful. I have tried
   with a for loop.

  Post your first try at a for loop, and people might be willing to
  point out problems, but this is such a basic for loop that it is
  unlikely that anybody is going to write your ENTIRE homework for you.

 This is probably what you (OP) were trying to come up with?
 [untested]

 d = {}
 for item in m:
     key = m[0];  value = m[1]
     if key is None or value is None: continue
     if key not in dict:
         d[key] = [value]
     else:
         d[key].append (value)

 You can replace the
   for item in m:
       key = m[0];  value = m[1]
 above with
   for key, value in m:
 which is a little nicer.

 However, as other responses point out, when you want
 to accumulate results in a dict, collections.defaultdict
 should pop into your mind first.

Oops, didn't read very carefully, did I?

That should be:
d = {}
for item in m:
key = m[0];  value = m[1]
if key is None or value is None: continue
if key not in dict:
d[key] = [1, value]
else:
d[key][0] += 1
d[key][1] += value

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


Re: Decorator to inject function into __call__ of a class

2010-03-13 Thread Jon Clements
On 13 Mar, 16:26, Patrick Maupin pmau...@gmail.com wrote:
 On Mar 13, 10:19 am, Jon Clements jon...@googlemail.com wrote:

  What I'd like to achieve is something similar to:

  @inject(B):
   def some_function(a, b):
       pass # something useful

 So, just typing at the keyboard here, you mean something like:

 class InjectClass(object):
     def __init__(self, func, *args, **kw):
         self.func = func
         self.args = args
         self.kw = kw
     def __call__(self):
         self.func(*self.args, **self.kw)

 Or exactly what are you looking for?

 Pat

Not quite.

Let's say I have function 'F':

def add(a, b): return a + b

And a base class of 'C' which does all the __init__ stuff or
whatever's needed,
the function 'add' should return a new class __init__'d with a and b,
but 'add'
should be the __call__ of that instance.

Hope that makes sense, and TY for your post,

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


Re: Decorator to inject function into __call__ of a class

2010-03-13 Thread Jack Diederich
On Sat, Mar 13, 2010 at 11:19 AM, Jon Clements jon...@googlemail.com wrote:
 This is semi-experimental and I'd appreciate opinions of whether it's
 the correct design approach or not. It seems like a good idea, but it
 doesn't mean it is.

 I have a class 'A', this provides standard support functions and
 exception handling.
 I have 'B' and 'C' which specialise upon 'A'

 What I'd like to achieve is something similar to:

 @inject(B):
  def some_function(a, b):
     pass # something useful

 The name 'some_function' is completely redundant -- don't need it,
 don't actually care about the function afterwards, as long as it
 becomes a __call__ of a 'B' *instance*.

 I've basically got a huge list of functions, which need to be the
 callable method of an object, and possibly at run-time, so I don't
 want to do:

 class Something(B):
    def __call__(self, etc.. etc...):
         pass # do something

 I've got as far as type(somename, (B,), {}) -- do I then __init__ or
 __new__ the object or...

 In short, the function should be the __call__ method of an object that
 is already __init__'d with the function arguments -- so that when the
 object is called, I get the result of the the function (based on the
 objects values).

I'm not sure exactly what you are asking for, but if what you want is
a bunch of different objects that vary only by their class's __call__
you could do it with a function that returns a new class based on A
but with a new __call__:

def make_new_call_class(base_class, call_func):
  class NewClass(base_class):
def __call__(self, *args, **kw):
  return call_func(self, *args, *kw)
  return NewClass

or the return could even be NewClass() [return an instance] if this is
a one off.

That said, I'm not really sure what this behavior is good for.

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


Re: Decorator to inject function into __call__ of a class

2010-03-13 Thread Patrick Maupin
On Mar 13, 10:38 am, Jon Clements jon...@googlemail.com wrote:
 On 13 Mar, 16:26, Patrick Maupin pmau...@gmail.com wrote:



  On Mar 13, 10:19 am, Jon Clements jon...@googlemail.com wrote:

   What I'd like to achieve is something similar to:

   @inject(B):
    def some_function(a, b):
        pass # something useful

  So, just typing at the keyboard here, you mean something like:

  class InjectClass(object):
      def __init__(self, func, *args, **kw):
          self.func = func
          self.args = args
          self.kw = kw
      def __call__(self):
          self.func(*self.args, **self.kw)

  Or exactly what are you looking for?

  Pat

 Not quite.

 Let's say I have function 'F':

 def add(a, b): return a + b

 And a base class of 'C' which does all the __init__ stuff or
 whatever's needed,
 the function 'add' should return a new class __init__'d with a and b,
 but 'add'
 should be the __call__ of that instance.

 Hope that makes sense, and TY for your post,

 Jon.

Well, you could do it with a class.  But if I'm understanding
correctly, maybe it's simpler than that:

 def inject(*args, **kw):
... def wrapper(func):
... def go():
... return func(*args, **kw)
... return go
... return wrapper
...
 @inject(20, 22)
... def add(a, b):
... return a + b
...
 add()
42
-- 
http://mail.python.org/mailman/listinfo/python-list


class inheritance

2010-03-13 Thread JLundell
I've got a subclass of fractions.Fraction called Value; it's a mostly
trivial class, except that it overrides __eq__ to mean 'nearly equal'.
However, since Fraction's operations result in a Fraction, not a
Value, I end up with stuff like this:

x = Value(1) + Value(2)

where x is now a Fraction, not a Value, and x == y uses
Fraction.__eq__ rather than Value.__eq__.

This appears to be standard Python behavior (int does the same thing).
I've worked around it by overriding __add__, etc, with functions that
invoke Fraction but coerce the result. But that's tedious; there are a
lot of methods to override.

So I'm wondering: is there a more efficient way to accomplish what I'm
after?
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: class inheritance

2010-03-13 Thread Patrick Maupin
On Mar 13, 11:03 am, JLundell jlund...@pobox.com wrote:
 I've got a subclass of fractions.Fraction called Value; it's a mostly
 trivial class, except that it overrides __eq__ to mean 'nearly equal'.
 However, since Fraction's operations result in a Fraction, not a
 Value, I end up with stuff like this:

 x = Value(1) + Value(2)

 where x is now a Fraction, not a Value, and x == y uses
 Fraction.__eq__ rather than Value.__eq__.

 This appears to be standard Python behavior (int does the same thing).
 I've worked around it by overriding __add__, etc, with functions that
 invoke Fraction but coerce the result. But that's tedious; there are a
 lot of methods to override.

 So I'm wondering: is there a more efficient way to accomplish what I'm
 after?

7 years ago, I had a similar problem for a different and now obsolete
reason.  I'm sure my solution could be easily updated though.  I wrote
code to write a wrapper class.  Sort of a meta-module.  Original
reference here:

http://groups.google.com/group/comp.lang.python/browse_frm/thread/1253bbab7dfd4b/59289c16603fb374?hl=enlnk=gstq=pmaupin+userint#59289c16603fb374

HTH,
Pat
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Decorator to inject function into __call__ of a class

2010-03-13 Thread Jon Clements
On 13 Mar, 16:42, Jack Diederich jackd...@gmail.com wrote:
 On Sat, Mar 13, 2010 at 11:19 AM, Jon Clements jon...@googlemail.com wrote:
  This is semi-experimental and I'd appreciate opinions of whether it's
  the correct design approach or not. It seems like a good idea, but it
  doesn't mean it is.

  I have a class 'A', this provides standard support functions and
  exception handling.
  I have 'B' and 'C' which specialise upon 'A'

  What I'd like to achieve is something similar to:

  @inject(B):
   def some_function(a, b):
      pass # something useful

  The name 'some_function' is completely redundant -- don't need it,
  don't actually care about the function afterwards, as long as it
  becomes a __call__ of a 'B' *instance*.

  I've basically got a huge list of functions, which need to be the
  callable method of an object, and possibly at run-time, so I don't
  want to do:

  class Something(B):
     def __call__(self, etc.. etc...):
          pass # do something

  I've got as far as type(somename, (B,), {}) -- do I then __init__ or
  __new__ the object or...

  In short, the function should be the __call__ method of an object that
  is already __init__'d with the function arguments -- so that when the
  object is called, I get the result of the the function (based on the
  objects values).

 I'm not sure exactly what you are asking for, but if what you want is
 a bunch of different objects that vary only by their class's __call__
 you could do it with a function that returns a new class based on A
 but with a new __call__:

 def make_new_call_class(base_class, call_func):
   class NewClass(base_class):
     def __call__(self, *args, **kw):
       return call_func(self, *args, *kw)
   return NewClass

 or the return could even be NewClass() [return an instance] if this is
 a one off.

 That said, I'm not really sure what this behavior is good for.

 -Jack

Cheers Jack for the response.

The behaviour is to not derive from a class, but rather allow
the decorators to do so... so I would like to iterate over
a list of functions (don't care what they're called) and then
inject the function as a method. If needs be at run-time.

Say I have 1000 functions (okay, admittedly over quoted), but
I don't want every programmer to inherit from 'B' or 'C', but
to 'inject'. So the idea is that classes are pre-defined, have
predictable behaviour, *except* the __call__ is different.

You are correct in this. Why do I want that behaviour? -

- It's easier, no inheriting from a class, when needs not.
- Some integrity (anyone can define a function and 'inject' to the
Management class)
- Easier maintainability - maybe :)

for i in function_list:
i = inject(function_list)

At the end of the day:
def blah(x, y, z):
   pass

That should be the callable of the object.

Cheers again,

Jon.

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


Re: building a dict

2010-03-13 Thread rurpy
On Mar 13, 9:26 am, ru...@yahoo.com wrote:
 That should be:
 d = {}
 for item in m:
      key = item[0];  value = item[1]
     if key is None or value is None: continue
     if key not in dict:
         d[key] = [1, value]
     else:
         d[key][0] += 1
         d[key][1] += value

That's it.  Any other mistakes, you find 'em.

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


Re: class inheritance

2010-03-13 Thread Jack Diederich
On Sat, Mar 13, 2010 at 12:03 PM, JLundell jlund...@pobox.com wrote:
 I've got a subclass of fractions.Fraction called Value; it's a mostly
 trivial class, except that it overrides __eq__ to mean 'nearly equal'.
 However, since Fraction's operations result in a Fraction, not a
 Value, I end up with stuff like this:

 x = Value(1) + Value(2)

 where x is now a Fraction, not a Value, and x == y uses
 Fraction.__eq__ rather than Value.__eq__.

 This appears to be standard Python behavior (int does the same thing).
 I've worked around it by overriding __add__, etc, with functions that
 invoke Fraction but coerce the result. But that's tedious; there are a
 lot of methods to override.

 So I'm wondering: is there a more efficient way to accomplish what I'm
 after?

If Fraction.__add__ returns a new object but the subclass Value is
compatible (as I would except since it is a sublcass) then just change
all references in Franction.__add__ to be more generic, ex/

class Franction():
  def __add__(self, other):
return self.__classs__(self.denominator + other.denominator)

That way if __add__ is called by an instance of a subclass it will
return an instance of that subclass.

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


Re: Decorator to inject function into __call__ of a class

2010-03-13 Thread Jack Diederich
On Sat, Mar 13, 2010 at 12:10 PM, Jon Clements jon...@googlemail.com wrote:
 On 13 Mar, 16:42, Jack Diederich jackd...@gmail.com wrote:
 On Sat, Mar 13, 2010 at 11:19 AM, Jon Clements jon...@googlemail.com wrote:
  This is semi-experimental and I'd appreciate opinions of whether it's
  the correct design approach or not. It seems like a good idea, but it
  doesn't mean it is.

  I have a class 'A', this provides standard support functions and
  exception handling.
  I have 'B' and 'C' which specialise upon 'A'

  What I'd like to achieve is something similar to:

  @inject(B):
   def some_function(a, b):
      pass # something useful

  The name 'some_function' is completely redundant -- don't need it,
  don't actually care about the function afterwards, as long as it
  becomes a __call__ of a 'B' *instance*.

  I've basically got a huge list of functions, which need to be the
  callable method of an object, and possibly at run-time, so I don't
  want to do:

  class Something(B):
     def __call__(self, etc.. etc...):
          pass # do something

  I've got as far as type(somename, (B,), {}) -- do I then __init__ or
  __new__ the object or...

  In short, the function should be the __call__ method of an object that
  is already __init__'d with the function arguments -- so that when the
  object is called, I get the result of the the function (based on the
  objects values).

 I'm not sure exactly what you are asking for, but if what you want is
 a bunch of different objects that vary only by their class's __call__
 you could do it with a function that returns a new class based on A
 but with a new __call__:

 def make_new_call_class(base_class, call_func):
   class NewClass(base_class):
     def __call__(self, *args, **kw):
       return call_func(self, *args, *kw)
   return NewClass

 or the return could even be NewClass() [return an instance] if this is
 a one off.

 That said, I'm not really sure what this behavior is good for.

 -Jack

 Cheers Jack for the response.

 The behaviour is to not derive from a class, but rather allow
 the decorators to do so... so I would like to iterate over
 a list of functions (don't care what they're called) and then
 inject the function as a method. If needs be at run-time.

 Say I have 1000 functions (okay, admittedly over quoted), but
 I don't want every programmer to inherit from 'B' or 'C', but
 to 'inject'. So the idea is that classes are pre-defined, have
 predictable behaviour, *except* the __call__ is different.

 You are correct in this. Why do I want that behaviour? -

 - It's easier, no inheriting from a class, when needs not.
 - Some integrity (anyone can define a function and 'inject' to the
 Management class)
 - Easier maintainability - maybe :)

 for i in function_list:
    i = inject(function_list)

 At the end of the day:
 def blah(x, y, z):
   pass

 That should be the callable of the object.

I'm still not sure why you are trying to do this, but you can do it
with delegation.  Have the parent class's __call__ look for an
instance attribute named call_this and then call it, ex/

class A():
  def __call__(self, *args, **kw):
self.call_this(*args, **kw)  # we grab this off the instance

ob = A()
def my_func(*stuff): pass
ob.call_this = my_func

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


Re: class inheritance

2010-03-13 Thread Patrick Maupin
On Mar 13, 11:37 am, Jack Diederich jackd...@gmail.com wrote:
 If Fraction.__add__ returns a new object but the subclass Value is
 compatible (as I would except since it is a sublcass) then just change
 all references in Franction.__add__ to be more generic, ex/

 class Franction():
   def __add__(self, other):
     return self.__classs__(self.denominator + other.denominator)

 That way if __add__ is called by an instance of a subclass it will
 return an instance of that subclass.


Yes, I think the OP understands that, and also understands that he
would have to do the same thing for __sub__, __div__, __rsub__,
__radd__, etc.

That's why I suggested that, instead of writing all that tedious code,
he could write code that writes the tedious code :-)

As Terence Parr of ANTLER fame asks:  Why program by hand in five
days what you can spend five years of your life automating?

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


RE: python to exe

2010-03-13 Thread CHEN Guang
Does anyone know of a good python to stand alone exe compiler?

Thanks,
-Robin

I tried several such tools and found the easiest one: Pyinstaller ( 
http://www.pyinstaller.org/ )
but it does not make your script faster, if you want it as fast as C language, 
please try PythoidC ( http://pythoidc.googlecode.com )
 -- 
http://mail.python.org/mailman/listinfo/python-list


[ANN] Pyspread 0.0.14b released

2010-03-13 Thread Martin Manns
Pyspread 0.0.14b released
=

I am pleased to announce the new release 0.0.14b 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


 * Cell border can be changed independently.
 * Cell access allows negative indices when not slicing.


Enjoy

Martin

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


Re: python to exe

2010-03-13 Thread Martin Schöön
Mark Lawrence breamore...@yahoo.co.uk writes:

 I'm certain that members of the Guinea Pig Club might have something
 to say on that one, see :-
 http://en.wikipedia.org/wiki/Guinea_Pig_Club

Interesting. My mum is a retired surgeon and in the mid 1980s she
attended a course in plastic surgery and among other things she
learnt that plastic surgery got going for real during WWII 'thanks'
to all pilots with burns. I have forwarded the link above to her.

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


Re: Use python and Jython together? (newbie)

2010-03-13 Thread MRAB

Karjer Jdfjdf wrote:
I'm pretty new at programming and want some advice on mixing Jython and 
Python.


I want to use Jython to access some Java libraries, but I want to keep 
developing in normal Python. Some modules I use a lot are not available 
in Jython.


The bulk of my programming is in Python but I want to use Java 2D 
libraries for graphical presentation of data generated in normal Python. 
Is it possible that I generate data in Python and then pass it through 
to a Jython program to visualise the data.



You could have 2 scripts running, one in CPython and the other in
Jython, communicating via sockets. You would need to decide on a
protocol, perhaps passing the data as strings encoded in UTF-8.
--
http://mail.python.org/mailman/listinfo/python-list


Re: class inheritance

2010-03-13 Thread JLundell
On Mar 13, 9:37 am, Jack Diederich jackd...@gmail.com wrote:
 If Fraction.__add__ returns a new object but the subclass Value is
 compatible (as I would except since it is a sublcass) then just change
 all references in Franction.__add__ to be more generic, ex/

 class Franction():
   def __add__(self, other):
     return self.__classs__(self.denominator + other.denominator)

 That way if __add__ is called by an instance of a subclass it will
 return an instance of that subclass.

That was my first thought, because I had originally assumed that's the
way Fraction worked. However, a) it's easier to do the overriding in
my own class than patching Fraction (or at least no harder), and 2)
Fraction is only doing the same thing that int does, so it's hard to
justify a patch.

I think Patrick's solution might be the tidiest one. I'll give it a
shot (thanks, Patrick).
-- 
http://mail.python.org/mailman/listinfo/python-list


how to start a python script only once

2010-03-13 Thread News123
Hi,

I'd like to make sure, that a certain python program will only be run
once per host. (linux/windows)


so if the program is started a second time it should just terminate and
let the other one run.

This does not have to be the fastest solution, but it should be reliable.


I have a few ideas, but wonder, which one is the most common


My ideas so far:

pid file and file locking
--
create a file like program.pid  with the pid of the running program an
use file locking to avoid race connditions.

However I currently don't know how to do file locking under windows
and I don't know how to do file lockng with python and linux.
I'll start googling.

sqlite and locking

quite some time ago I used a mysql table and locking as an inter-host mutex.

Perhaps sqlite would be good enough for an inter process mutex for
processes on the same host, but I don't know it well enough.


interprocess mutex

well I even don't know whether something like this exists on linux / windows


Thanks in advanced for any tips



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


Re: python to exe

2010-03-13 Thread John Bokma
Steven D'Aprano st...@remove-this-cybersource.com.au writes:

 As the old proverb goes: give a man a fish, and you feed him for a day. 
 Teach him how to fish, and he has food forever.

True, but you don't teach someone fishing by poking an eye out with a
fishing rod.

 I'm an old-fashioned kind of guy, and don't like LMGTFY because it is 
 tiresome and requires Javascript. I prefer:

My reply had little to do with lmgtfy and all to do with hiding it behind
tinyurl. But even then, why not do what you just did: give a URL to
google directly.

For quite some time I thought that comp.lang.perl.misc was quite
unfriendly because of a certain attitude. comp.lang.python was quite a
refreshment for a while: very newbie friendly, less pissing contests,
etc. (but way more fanboism). 

Yesterday was a sady day: I finally had to conclude that it was only
wishful thinking on my part; there is no difference.

-- 
John Bokma   j3b

Hacking  Hiking in Mexico -  http://johnbokma.com/
http://castleamber.com/ - Perl  Python Development
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Some PyCon videos won't play

2010-03-13 Thread Terry Reedy

On 3/13/2010 11:23 AM, Lee Harr wrote:


I am having a great time watching videos from PyCon. Thanks to
everyone who presented, and to those who did such a great job
putting the videos up at: http://pycon.blip.tv/

My trouble is that, although most of the videos play perfectly,
there are a few that refuse to play at all. Like:

Python 101
http://pycon.blip.tv/file/3322312/

Using Python to Create Robotic Simulations for Planetary Exploration
http://pycon.blip.tv/file/3332780/

Saturday Morning Lightning talks
http://pycon.blip.tv/file/3264041/


Is anyone else having trouble with these?


Yes, 'spinner' spins indefinitely, while others load and play.

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


Re: Decorator to inject function into __call__ of a class

2010-03-13 Thread Stephen Hansen
On Sat, Mar 13, 2010 at 8:19 AM, Jon Clements jon...@googlemail.com wrote:

 The name 'some_function' is completely redundant -- don't need it,
 don't actually care about the function afterwards, as long as it
 becomes a __call__ of a 'B' *instance*.


Special methods are looked up on the class, not the instance, so you can't
dot his. However, from reading this thread, I think you're just a bit hung
up on naming: you don't need these random / arbitrary functions to be the
__call__ on an instance.

You need these functions to be called when said instance is called.

The easiest way to do that is simply define on the class:

def __call__(self, *args, **kwargs):
self.func(*args, **kwargs)

Then while you are iterating over your list of a thousand functions and
making instances, just assign each instance's func attribute.

So,

for fn in [function_one, function_two, function_three, function_four]:
inst = B()
inst.func = fn

Now, if you really like the decorator syntax, sure:

 def inject(klass):
... def decorator(fn):
... inst = klass()
... inst.func = fn
... return inst
... return decorator
...
 class A:
... def __init__(self):
... pass
... def __call__(self, *args, **kwargs):
... self.func(*args, **kwargs)
...
 @inject(A)
... def test(mmm):
... print mmm
...
 test
__main__.A instance at 0x1004a4fc8
 test(Hello)
Hello

Now, I don't -fully- understand what you're trying to do so this may not be
precisely the right thing, but you should be able to adapt the theory.

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


Re: Decorator to inject function into __call__ of a class

2010-03-13 Thread Jon Clements
On 13 Mar, 17:42, Jack Diederich jackd...@gmail.com wrote:
 On Sat, Mar 13, 2010 at 12:10 PM, Jon Clements jon...@googlemail.com wrote:
  On 13 Mar, 16:42, Jack Diederich jackd...@gmail.com wrote:
  On Sat, Mar 13, 2010 at 11:19 AM, Jon Clements jon...@googlemail.com 
  wrote:
   This is semi-experimental and I'd appreciate opinions of whether it's
   the correct design approach or not. It seems like a good idea, but it
   doesn't mean it is.

   I have a class 'A', this provides standard support functions and
   exception handling.
   I have 'B' and 'C' which specialise upon 'A'

   What I'd like to achieve is something similar to:

   @inject(B):
    def some_function(a, b):
       pass # something useful

   The name 'some_function' is completely redundant -- don't need it,
   don't actually care about the function afterwards, as long as it
   becomes a __call__ of a 'B' *instance*.

   I've basically got a huge list of functions, which need to be the
   callable method of an object, and possibly at run-time, so I don't
   want to do:

   class Something(B):
      def __call__(self, etc.. etc...):
           pass # do something

   I've got as far as type(somename, (B,), {}) -- do I then __init__ or
   __new__ the object or...

   In short, the function should be the __call__ method of an object that
   is already __init__'d with the function arguments -- so that when the
   object is called, I get the result of the the function (based on the
   objects values).

  I'm not sure exactly what you are asking for, but if what you want is
  a bunch of different objects that vary only by their class's __call__
  you could do it with a function that returns a new class based on A
  but with a new __call__:

  def make_new_call_class(base_class, call_func):
    class NewClass(base_class):
      def __call__(self, *args, **kw):
        return call_func(self, *args, *kw)
    return NewClass

  or the return could even be NewClass() [return an instance] if this is
  a one off.

  That said, I'm not really sure what this behavior is good for.

  -Jack

  Cheers Jack for the response.

  The behaviour is to not derive from a class, but rather allow
  the decorators to do so... so I would like to iterate over
  a list of functions (don't care what they're called) and then
  inject the function as a method. If needs be at run-time.

  Say I have 1000 functions (okay, admittedly over quoted), but
  I don't want every programmer to inherit from 'B' or 'C', but
  to 'inject'. So the idea is that classes are pre-defined, have
  predictable behaviour, *except* the __call__ is different.

  You are correct in this. Why do I want that behaviour? -

  - It's easier, no inheriting from a class, when needs not.
  - Some integrity (anyone can define a function and 'inject' to the
  Management class)
  - Easier maintainability - maybe :)

  for i in function_list:
     i = inject(function_list)

  At the end of the day:
  def blah(x, y, z):
    pass

  That should be the callable of the object.

 I'm still not sure why you are trying to do this, but you can do it
 with delegation.  Have the parent class's __call__ look for an
 instance attribute named call_this and then call it, ex/

 class A():
   def __call__(self, *args, **kw):
     self.call_this(*args, **kw)  # we grab this off the instance

 ob = A()
 def my_func(*stuff): pass
 ob.call_this = my_func

 -Jack

Jack, thanks very much for your replies -- hugely appreciated.

I was delayed by the missus calling me for dinner - I'd forgotten
we had a stew going in the slow cooker, and she can't make
dumplings to save her life :)

If I can re-explain slightly, say I have a class 'compute':

class Compute(object):
def __init__(self, something):
self.something = something
# misc other methods here.

then...

class ComputeAdd(Compute):
pass

If I do,

@inject
def ComputeAdd(fst, snd):
return fst + snd

The end result should be a new class called ComputeAdd __init__'d with
fst and snd,
which when called, returns fst + snd.

Hope that makes sense.

Cheers,

Jon.

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


Re: python to exe

2010-03-13 Thread Almar Klein
Does anyone know of a good python to stand alone exe compiler?


 Thanks,
 -Robin
 I tried several such tools and found the easiest one: Pyinstaller (
 http://www.pyinstaller.org/ )


Don't forget cx_freeze! I found it to work pretty easy, and it also works
for py3k.

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


Re: python to exe

2010-03-13 Thread Martin P. Hellwig

On 03/13/10 19:23, Steven D'Aprano wrote:

On Sat, 13 Mar 2010 12:52:39 -0600, John Bokma wrote:


For quite some time I thought that comp.lang.perl.misc was quite
unfriendly because of a certain attitude. comp.lang.python was quite a
refreshment for a while: very newbie friendly, less pissing contests,
etc. (but way more fanboism).

Yesterday was a sady day: I finally had to conclude that it was only
wishful thinking on my part; there is no difference.



You were the first one to inject abuse into this thread. There's a big
difference between a mildly sarcastic link and dropping the F-word at one
of the more helpful and respected members of the community. Perhaps you
are projecting your own hostility and aggro onto others?



John's thought process is a slippery slope and I make the same 'mistake' 
(notice the quotes please :-)) so often it would seem I won't learn it 
ever. However on the rare occasion I notice that I am making the mistake 
I say to myself: The view of a number of individuals do NOT necessarily 
represent the view of the majority unless proven otherwise by that 
actual majority.


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


Re: class inheritance

2010-03-13 Thread Carl Banks
On Mar 13, 9:03 am, JLundell jlund...@pobox.com wrote:
 I've got a subclass of fractions.Fraction called Value; it's a mostly
 trivial class, except that it overrides __eq__ to mean 'nearly equal'.
 However, since Fraction's operations result in a Fraction, not a
 Value, I end up with stuff like this:

 x = Value(1) + Value(2)

 where x is now a Fraction, not a Value, and x == y uses
 Fraction.__eq__ rather than Value.__eq__.

 This appears to be standard Python behavior (int does the same thing).
 I've worked around it by overriding __add__, etc, with functions that
 invoke Fraction but coerce the result. But that's tedious; there are a
 lot of methods to override.

 So I'm wondering: is there a more efficient way to accomplish what I'm
 after?

It's a tad unfortunately Python doesn't make this easier.  If I had to
do it more than once I'd probably write a mixin to do it:

class ArithmeticSelfCastMixin(object):
def __add__(self,other):
return
self.__class__(super(ArithmeticSelfCastMixin,self).__add__(other)
# etc.


class Value(ArithmeticSelfCastMixin,fraction.Fraction):
pass


However, I want to warn you about overriding __eq__ to mean almost
equal: it can have unexpected results so I don't recommend it.  Two
of the main issues with it are:

1. It violates the transitive property (If A == B and B == C, then A
== C) which most programmers expect to be true.

2. It will give unpredictable results when the objects are used in
sets or as dictionary keys.  Those thow types expect the transitive
property to be true.  If you are going to redefine __eq__ to mean
almost equal, then at least define __hash__ to raise
NotImplementedError so that Python will refuse to use them in sets or
as dictionary keys:

def __hash__(self): raise NotImplementedError


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


Re: Python for newbies (Pythno users group in Macedonia)

2010-03-13 Thread Mike C. Fletcher
Дамјан Георгиевски wrote:
 Hi all,
 we are starting with bi-monthly Python User Group meetings in Skopje, 
 Macedonia. The meetings are targeted for both beginners and more 
 experienced users.
   
...
http://us.pycon.org/2010/conference/schedule/event/108/

HTH,
Mike

-- 

  Mike C. Fletcher
  Designer, VR Plumber, Coder
  http://www.vrplumber.com
  http://blog.vrplumber.com

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


Re: building a dict

2010-03-13 Thread vsoler
On 13 mar, 18:16, ru...@yahoo.com wrote:
 On Mar 13, 9:26 am, ru...@yahoo.com wrote: That should be:
  d = {}
  for item in m:

       key = item[0];  value = item[1]

      if key is None or value is None: continue
      if key not in dict:
          d[key] = [1, value]
      else:
          d[key][0] += 1
          d[key][1] += value

 That's it.  Any other mistakes, you find 'em.

Thank you all. Your answers are more than valuable to me. I'll study
them carefully, but no doubt, my post has been answered.

By the way, I suppose I am the OP. Since I am not an native English
speaking person, I do not know what it stands for. Perhaps you can
tell me.

From what I see from your posts, you would have preferred that I
included in my original post my for loop, so that the post is not so
abstract. I have taken note and I'll make it better next time.

Thank you for your help.

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


Re: building a dict

2010-03-13 Thread rurpy
On Mar 13, 2:42 pm, vsoler vicente.so...@gmail.com wrote:

 By the way, I suppose I am the OP. Since I am not an native English
 speaking person, I do not know what it stands for. Perhaps you can
 tell me.

OP means Original Poster (the person who started the discussion)
or sometimes Original Post, depending on context.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: python to exe

2010-03-13 Thread Gib Bogle

Mark Lawrence wrote:


I'm certain that members of the Guinea Pig Club might have something to 
say on that one, see :-

http://en.wikipedia.org/wiki/Guinea_Pig_Club



You mean, something like: That's not funny?
--
http://mail.python.org/mailman/listinfo/python-list


Re: Use python and Jython together? (newbie)

2010-03-13 Thread Waldemar Osuch
On Mar 13, 8:10 am, Christian Heimes li...@cheimes.de wrote:
 Karjer Jdfjdf wrote:
  I'm pretty new at programming and want some advice on mixing Jython and 
  Python.

  I want to use Jython to access some Java libraries, but I want to keep 
  developing in normal Python. Some modules I use a lot are not available in 
  Jython.

  The bulk of my programming is in Python but I want to use Java 2D libraries 
  for graphical presentation of data generated in normal Python. Is it 
  possible that I generate data in Python and then pass it through to a 
  Jython program to visualise the data.

 You can't mix Jython and Python in one program. But you can use other
 means to create bindings for Java code. JCC
 (http://pypi.python.org/pypi/JCC/2.5.1) is a very powerful code
 generator for CPython.

I have not tried it myself but it seems to be possible.
http://jpype.sourceforge.net/

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


Clustering and automated configuration deployment toolkit with Python

2010-03-13 Thread np map
I'd like to write an open source clustering (for computation and
general use) and automation of configuration/deployment in Python.
It's main purpose is to be used in academic environments.
It would be something like running numpy/simpy code (and other custom
python code) on a set of machines in a distributed fashion (e.g.
splitting tasks, doing certain bits on some machines, other sub-tasks
on other machines, etc).

The cluster could be used in at least two ways:
- submit code/files via a web interface, monitor the task via the web
interface and download the results from the master node  (userweb
interfacemaster)
- run code directly from another machine on the cluster (as if it were
a subprocess or something like this)


Requirements (so far):
- support the Ubuntu Linux distribution in the initial iteration
- be easy to extend to other OS-es and package managers
- try to be 3.x compatible where dual compatibility is possible (2.x
and 3.x)
- it will support Python 2.5-2.6
- document required changes to the 2.x only code to make it work on
3.x
- make it easy to submit code directly from python scripts to the
cluster (with the right credentials)
- support key based authentication for job submission
- should talk to at least one type of RDBMS to store various types of
data
- the cluster should be able to kill a task on nodes automatically if
it executes for too long or requires too much memory (configurable)
- should be modular (use automation  configuration or just
clustering)


Therefore, I'd like to know a few things:

Is there a clustering toolkit already available for python?

What would the recommended architecture be ?

How should the user code interface with the clustering system's
code?

How should the results be stored (at the node and master level)?

Should threading be supported in the tasks?

How should they be returned to the Master node(s)? (polling, submitted
by the nodes, etc)

What libraries should be used for this? (e.g. fabric as a library,
pyro, etc)

Any other suggestions and pieces of advice?

Should Fabric be used in this clustering system for automation? If
not, what else? Would simply using a wrapper written in python for the
'ssh' app be ok?

Would the following architecture be ok?
Master: splits tasks into sub-tasks, sends them to nodes - provided
the node's load isn't greater than a certain percentage, gets results,
stores and provides configuration to nodes, stores results, etc
Node: runs code, applies configuration, submits the results to the
master, etc

If this system actually gets python-level code submission inside, how
should it work?

The reason I posted this set of questions and ideas is that I'd like
this to be as flexible and usable as possible.

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


Feeding differeent data types to a class instance?

2010-03-13 Thread kuru
Hi

I have couple classes in the form of

class Vector:
  def __init__(self,x,y,z):
   self.x=x
   self.y=y
   self.z=z

This works fine for me. However I want to be able to provide a list,
tuple as well as individual arguments like below

myvec=Vector(1,2,3)

This works well


However I  also want to be able to do

vect=[1,2,3]

myvec=Vec(vect)

I want this class to accept multiple data types but process them as
they are same when the classs deals with the instances.

thanks


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


Re: Feeding differeent data types to a class instance?

2010-03-13 Thread Rhodri James

On Sun, 14 Mar 2010 00:34:55 -, kuru maymunbe...@gmail.com wrote:


Hi

I have couple classes in the form of

class Vector:
  def __init__(self,x,y,z):
   self.x=x
   self.y=y
   self.z=z

This works fine for me. However I want to be able to provide a list,
tuple as well as individual arguments like below

myvec=Vector(1,2,3)

This works well


However I  also want to be able to do

vect=[1,2,3]

myvec=Vec(vect)


You can do something like:

class Vector(object):
  def __init__(self, x, y=None, z=None):
if isinstance(x, list):
  self.x = x[0]
  self.y = x[1]
  self.z = x[2]
else:
  self.x = x
  self.y = y
  self.z = z

but this gets messy quite quickly.  The usual wisdom these days is to  
write yourself a separate class method to create your object from a  
different type:


class Vector(object):
  ... def __init__ as you did before ...

  @classmethod
  def from_list(cls, lst):
return cls(lst[0], lst[1], lst[2])

vect = [1,2,3]
myvec = Vector.from_list(vect)


--
Rhodri James *-* Wildebeeste Herder to the Masses
--
http://mail.python.org/mailman/listinfo/python-list


Re: python to exe

2010-03-13 Thread David Monaghan
On Sat, 13 Mar 2010 12:52:39 -0600, John Bokma j...@castleamber.com wrote:

Steven D'Aprano st...@remove-this-cybersource.com.au writes:

 As the old proverb goes: give a man a fish, and you feed him for a day. 
 Teach him how to fish, and he has food forever.

True, but you don't teach someone fishing by poking an eye out with a
fishing rod.

 I'm an old-fashioned kind of guy, and don't like LMGTFY because it is 
 tiresome and requires Javascript. I prefer:

My reply had little to do with lmgtfy and all to do with hiding it behind
tinyurl. But even then, why not do what you just did: give a URL to
google directly.

For quite some time I thought that comp.lang.perl.misc was quite
unfriendly because of a certain attitude. comp.lang.python was quite a
refreshment for a while: very newbie friendly, less pissing contests,
etc. (but way more fanboism). 

Yesterday was a sady day: I finally had to conclude that it was only
wishful thinking on my part; there is no difference.

There was a time, when the internet was young and most newbies couldn't find
their own backsides with both hands, that your conclusions would be well
placed.That time has long passed: Newsgroups are a long way down the
hierarchy since those times and anyone turning up here nowadays _has_ heard
of Google. If they haven't used it, I don't really consider the gentle
reminder that LMGTFY gives too harsh. If you do, you're too much of a gentle
soul to be on the internet at all; someone might say Boo to you at any
moment. Beware.

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


Re: building a dict

2010-03-13 Thread Andreas Waldenburger
On Sat, 13 Mar 2010 13:42:12 -0800 (PST) vsoler
vicente.so...@gmail.com wrote:

 By the way, I suppose I am the OP. Since I am not an native English
 speaking person, I do not know what it stands for. Perhaps you can
 tell me.
 
Perhaps you can find out yourself:

http://www.urbandictionary.com/define.php?term=op

/W


-- 
INVALID? DE!

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


Re: python to exe

2010-03-13 Thread Steven D'Aprano
On Sun, 14 Mar 2010 11:20:15 +1300, Gib Bogle wrote:

 Mark Lawrence wrote:
 
 I'm certain that members of the Guinea Pig Club might have something to
 say on that one, see :-
 http://en.wikipedia.org/wiki/Guinea_Pig_Club
 
 
 You mean, something like: That's not funny?

Or possibly That's hilarious!!!. Gallows humour is sometimes hard to 
predict.



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


Re: Feeding differeent data types to a class instance?

2010-03-13 Thread Steven D'Aprano
On Sat, 13 Mar 2010 16:34:55 -0800, kuru wrote:

 I want this class to accept multiple data types but process them as they
 are same when the classs deals with the instances.

The usual term for this is polymorphism.

 myvec=Vector(1,2,3)

 vect=[1,2,3]
 myvec=Vec(vect)

I assume you mean Vector in the last line.

I find this the easiest way to handle this situation:

class Vector(object, *args):
if len(args) == 1:
# Assume the caller passed a list argument.
args = args[0]
x, y, z = args  # Unpack the arguments.
# then process as normal.



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


Re: NoSQL Movement?

2010-03-13 Thread Jonathan Gardner
On Fri, Mar 12, 2010 at 11:23 AM, Paul Rubin no.em...@nospam.invalid wrote:
 D'Arcy J.M. Cain da...@druid.net writes:
 Just curious, what database were you using that wouldn't keep up with
 you?  I use PostgreSQL and would never consider going back to flat
 files.

 Try making a file with a billion or so names and addresses, then
 compare the speed of inserting that many rows into a postgres table
 against the speed of copying the file.


Also consider how much work it is to partition data from flat files
versus PostgreSQL tables.

 The only thing I can think of that might make flat files faster is
 that flat files are buffered whereas PG guarantees that your
 information is written to disk before returning

 Don't forget all the shadow page operations and the index operations,
 and that a lot of these operations require reading as well as writing
 remote parts of the disk, so buffering doesn't help avoid every disk
 seek.


Plus the fact that your other DB operations slow down under the load.

-- 
Jonathan Gardner
jgard...@jonathangardner.net
-- 
http://mail.python.org/mailman/listinfo/python-list


[issue8130] except-as in Py3 eats variables

2010-03-13 Thread Ezio Melotti

Ezio Melotti ezio.melo...@gmail.com added the comment:

In this case I don't see much difference between deleting a variable or 
assigning it to something else.

This code works on both Python 2 and 3:
 e = 'test'
 try: pass# no errors raised here
... except Exception as e: pass  # this is not executed
...
 e
'test'

If you do this instead:
 e = 'test'
 try: raise ValueError# raise the error
... except Exception as e: pass  # this is executed
...

On both 2.x and 3.x 'e' doesn't refer to 'test' anymore in the moment that the 
exception is captured by the except, so what happens next to the new e is not 
related to what the old e was.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue8130
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8128] String interpolation with unicode subclass fails to call __str__

2010-03-13 Thread Eric Smith

Changes by Eric Smith e...@trueblade.com:


--
nosy: +eric.smith

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue8128
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8130] except-as in Py3 eats variables

2010-03-13 Thread Florent Xicluna

Florent Xicluna florent.xicl...@gmail.com added the comment:

See also #4617, with some patch.

--
nosy: +flox
superseder:  - SyntaxError when free variable name is also an exception target

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue8130
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4617] SyntaxError when free variable name is also an exception target

2010-03-13 Thread Florent Xicluna

Changes by Florent Xicluna florent.xicl...@gmail.com:


Removed file: http://bugs.python.org/file16341/unnamed

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue4617
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4617] SyntaxError when free variable name is also an exception target

2010-03-13 Thread Florent Xicluna

Changes by Florent Xicluna florent.xicl...@gmail.com:


--
components: +Interpreter Core
nosy: +flox
stage:  - test needed
type:  - behavior

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue4617
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8128] String interpolation with unicode subclass fails to call __str__

2010-03-13 Thread Florent Xicluna

Changes by Florent Xicluna florent.xicl...@gmail.com:


--
nosy: +flox

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue8128
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8129] Wrong arguments in sqlite3.connect() documentation

2010-03-13 Thread Florent Xicluna

Changes by Florent Xicluna florent.xicl...@gmail.com:


--
priority:  - normal
stage:  - needs patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue8129
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8131] Delivery Status Notification (Failure)

2010-03-13 Thread reynaldo

New submission from reynaldo renbe...@gmail.com:

www.google.com/chromebeta/what a browser

-- Forwarded message --
From: Mail Delivery Subsystem mailer-dae...@googlemail.com
Date: Mar 13, 2010 1:31 AM
Subject: Delivery Status Notification (Failure)
To: renbe...@gmail.com

Delivery to the following recipient failed permanently:

homepagewebsitebrow...@gmail.com

Technical details of permanent failure:
The email account that you tried to reach does not exist. Please try
double-checking the recipient's email address for typos or unnecessary
spaces. Learn more at
http://mail.google.com/support/bin/answer.py?answer=6596

- Original message -

Return-Path: renbe...@gmail.com
Received-SPF: pass (google.com: domain of renbe...@gmail.com designates
10.216.85.9 as permitted sender) client-ip=10.216.85.9;
Authentication-Results: mr.google.com; spf=pass (google.com: domain of
renbe...@gmail.com designates 10.216.85.9 as permitted sender) smtp.mail=
renbe...@gmail.com; dkim=pass header.i=renbe...@gmail.com
Received: from mr.google.com ([10.216.85.9])
   by 10.216.85.9 with SMTP id t9mr1284787wee.79.1268472666728 (num_hops
= 1);
   Sat, 13 Mar 2010 01:31:06 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
   d=gmail.com; s=gamma;
   h=domainkey-signature:mime-version:received:in-reply-to:references
:date:message-id:subject:from:to:content-type;
   bh=e95TaoJEoSEO0fI8PxX3gWmPAWk7MpFGuxo5WXR7c5s=;
   b=ryAtBQKbrkyqTmY9I7u9+8+TU18Nn0sUpEQdUKNMv9qLD4DcFTgrs5+Cl9yajGzLRR
blBWEtQT7JePAJSXemEJWH+qwSlpv0j/MHONzSYvtImdpxUAH5m5ROAIb2syRtJ3MsC0
6Z6VTwMh9+3tlrGMKddmKV0w7EuEVGvWLM1BA=
DomainKey-Signature: a=rsa-sha1; c=nofws;
   d=gmail.com; s=gamma;
   h=mime-version:in-reply-to:references:date:message-id:subject:from:to
:content-type;
   b=PopzoxmDZC0tp09qENK/OV5l98fQkpgX8A/ZezTstyFIONBDDC6ky9PGrzUk17u1zq
v1DYZ5TdIpXdC+/hyA9QNW7XfEST/yG7jqSBeVA12Fmly1EZ7VRps+MBCWVBXFyZvnhR
uihbsR+Wn2fR+8kPZplTiwSfHE/5J0fnA/hyY=
MIME-Version: 1.0
Received: by 10.216.85.9 with SMTP id t9mr1284787wee.79.1268472666716; Sat,
13
   Mar 2010 01:31:06 -0800 (PST)
In-Reply-To: a4f83ee11003130105m66a12835rba0a259420917...@mail.gmail.com
References: a4f83ee11003130105m66a12835rba0a259420917...@mail.gmail.com
Date: Sat, 13 Mar 2010 01:31:06 -0800
Message-ID: a4f83ee11003130131o12d5386ft2393da2951edc...@mail.gmail.com
Subject: Fwd: Re: Few tweaks

From: reynaldo bendijo renbe...@gmail.com
To: homepagewebsitebrow...@gmail.com
Content-Type: multipart/alternative; boundary=0016e6d778afb50bc50481ab4e58

www.google.com/chromebeta/what a browser

-- Forwarded message --
From: reynaldo b...

--
files: unnamed
messages: 100998
nosy: renben
severity: normal
status: open
title: Delivery Status Notification (Failure)
Added file: http://bugs.python.org/file16531/unnamed

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue8131
___p/p
pa 
href=http://www.google.com/chromebeta/what;www.google.com/chromebeta/what/a 
a browser/p
pblockquote type=cite-- Forwarded message --brFrom: 
quot;Mail Delivery Subsystemquot; lt;a 
href=mailto:mailer-dae...@googlemail.com;mailer-dae...@googlemail.com/agt;brDate:
 Mar 13, 2010 1:31 AMbr
Subject: Delivery Status Notification (Failure)brTo:  lt;a 
href=mailto:renbe...@gmail.com;renbe...@gmail.com/agt;brbrDelivery to 
the following recipient failed permanently:br
br
     a 
href=mailto:homepagewebsitebrow...@gmail.com;homepagewebsitebrow...@gmail.com/abr
br
Technical details of permanent failure:br
The email account that you tried to reach does not exist. Please try 
double-checking the recipient#39;s email address for typos or unnecessary 
spaces. Learn more at a 
href=http://mail.google.com/support/bin/answer.py?answer=6596; 
target=_blankhttp://mail.google.com/support/bin/answer.py?answer=6596/abr

br
- Original message -br
br
Return-Path: lt;a 
href=mailto:renbe...@gmail.com;renbe...@gmail.com/agt;br
Received-SPF: pass (a href=http://google.com; target=_blankgoogle.com/a: 
domain of a href=mailto:renbe...@gmail.com;renbe...@gmail.com/a designates 
10.216.85.9 as permitted sender) client-ip=10.216.85.9;br
Authentication-Results: a href=http://mr.google.com; 
target=_blankmr.google.com/a; spf=pass (a href=http://google.com; 
target=_blankgoogle.com/a: domain of a 
href=mailto:renbe...@gmail.com;renbe...@gmail.com/a designates 10.216.85.9 
as permitted sender) smtp.mail=a 
href=mailto:renbe...@gmail.com;renbe...@gmail.com/a; dkim=pass header.i=a 
href=mailto:renbe...@gmail.com;renbe...@gmail.com/abr

Received: from a href=http://mr.google.com; target=_blankmr.google.com/a 
([10.216.85.9])br
        by 10.216.85.9 with SMTP id t9mr1284787wee.79.1268472666728 
(num_hops = 1);br
        Sat, 13 Mar 2010 01:31:06 -0800 (PST)br
DKIM-Signature: v=1; a=rsa-sha256; 

[issue8131] Delivery Status Notification (Failure)

2010-03-13 Thread Ezio Melotti

Changes by Ezio Melotti ezio.melo...@gmail.com:


--
resolution:  - invalid
stage:  - committed/rejected
status: open - closed

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue8131
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7845] complex.__lt__ should return NotImplemented instead of raising TypeError

2010-03-13 Thread Mark Dickinson

Mark Dickinson dicki...@gmail.com added the comment:

Applied in r78902.

--
resolution:  - accepted
stage: patch review - committed/rejected
status: open - closed

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue7845
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8014] Setting a T_INT attribute raises internal error

2010-03-13 Thread Mark Dickinson

Mark Dickinson dicki...@gmail.com added the comment:

Thanks, Benjamin!  test_structmembers.py looks perfect.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue8014
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8014] Setting a T_INT attribute raises internal error

2010-03-13 Thread Mark Dickinson

Mark Dickinson dicki...@gmail.com added the comment:

Tests for this issue, currently failing on T_INT/T_UINT (internal error), 
T_LONG/T_ULONG (fails to raise TypeError), T_PYSSIZET (internal error).   The 
older patch only fixes the T_PYSSIZET failures; I'm working on a fix for the 
others.

--
Added file: http://bugs.python.org/file16532/issue8014_tests.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue8014
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8014] Setting a T_INT attribute raises internal error

2010-03-13 Thread Mark Dickinson

Mark Dickinson dicki...@gmail.com added the comment:

Internal errors for T_UINT and T_PYSSIZET fixed in r78918.  The fix needs to be 
backported to the release31-maint branch, but I don't think it's urgent enough 
to try getting it in between 3.1.2 rc1 and 3.1.2 final.

There's still a problem with testing repeated attribute setting for T_UINT and 
T_ULONG;  for some reason, the first attempt to set a T_UINT attribute to 
something invalid correctly produces TypeError, but an immediately following 
second attempt doesn't raise TypeError---this can be seen by uncommenting the 
T_UINT and T_ULONG bits in test_bad_assignments.  Am investigating.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue8014
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8014] Setting a T_INT attribute raises internal error

2010-03-13 Thread Mark Dickinson

Mark Dickinson dicki...@gmail.com added the comment:

Fixed reason for failing tests (there was a bad error check in structmembers.c 
that compared a return value with (unsigned int)-1 instead of (unsigned 
long)-1), and re-enabled those tests, in r78920.

Leaving open for the backport to 3.1.

--
versions:  -Python 3.2

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue8014
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8132] email.header.decode_header makes mistakes

2010-03-13 Thread grumetz

New submission from grumetz jpgrum...@free.fr:

Examples:

s = '=?UTF-8?B?QWNjdXPDqSBkZSByw6ljZXB0aW9uIChhZmZpY2jDqSkgLSA=?=Arobase !'
decode_header(s) ---
[('=?UTF-8?B?QWNjdXPDqSBkZSByw6ljZXB0aW9uIChhZmZpY2jDqSkgLSA=?=Arobase !', 
None)]
which seems bad...
but
ss ='=?UTF-8?B?QWNjdXPDqSBkZSByw6ljZXB0aW9uIChhZmZpY2jDqSkgLSA=?= Arobase !'
decode_header(ss) ---
[('Accus\xc3\xa9 de r\xc3\xa9ception (affich\xc3\xa9) - ', 'utf-8'), ('Arobase 
!', None)]
which seems good...

--
components: Library (Lib)
messages: 101004
nosy: grmtz
severity: normal
status: open
title: email.header.decode_header makes mistakes
type: behavior
versions: Python 2.6

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue8132
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8073] Test fail for sha512

2010-03-13 Thread Chris Lieb

Chris Lieb chris.lieb.hotmail+pyt...@gmail.com added the comment:

Just for reference, I tried applying all of the patches in the SuSE 11.2 source 
RPM python-2.6.4.92-3.1.src.rpm from 
http://software.opensuse.org/search?q=python and rebuilding and retesting, but 
got the same results as using the vanilla Python 2.6.4 sources.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue8073
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8011] traceback tb_lineno example needs correction for Python3

2010-03-13 Thread Michael Newman

Michael Newman michael.b.new...@gmail.com added the comment:

No problem. Please note its actually fixed in r78895 (trunk), r78896 (py3k) and 
r78897 (release31-maint). Your previous message had the svn revision numbers 
off by 1000.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue8011
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue3928] os.mknod missing on Solaris

2010-03-13 Thread Jesús Cea Avión

Jesús Cea Avión j...@jcea.es added the comment:

The patch seems to be trivial. I need review, specially compiling under 
non-Solaris OS.

I plan to commit this patch to 2.6, 2.7, 3.1 and 3.2.

Must I update NEWS?

--
assignee:  - jcea
keywords: +needs review, patch
nosy: +jcea
priority:  - normal
Added file: http://bugs.python.org/file16533/mknod-solaris.diff

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue3928
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue3928] os.mknod missing on Solaris

2010-03-13 Thread Jesús Cea Avión

Changes by Jesús Cea Avión j...@jcea.es:


--
stage:  - patch review

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue3928
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue3871] cross and native build of python for mingw32 with distutils

2010-03-13 Thread Roumen Petrov

Roumen Petrov bugtr...@roumenpetrov.info added the comment:

distutils from trunk is restored to state before 9 months ago

--
Added file: http://bugs.python.org/file16534/python-trunk-20100313-MINGW.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue3871
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue3928] os.mknod missing on Solaris

2010-03-13 Thread Antoine Pitrou

Antoine Pitrou pit...@free.fr added the comment:

Compiles fine under Debian stable.
You shouldn't commit to 2.6 until 2.6.5 is released, though. If you want to do 
so, contact Barry first.

--
nosy: +pitrou

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue3928
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue3928] os.mknod missing on Solaris

2010-03-13 Thread Martin v . Löwis

Martin v. Löwis mar...@v.loewis.de added the comment:

You do need a NEWS entry.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue3928
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue3871] cross and native build of python for mingw32 with distutils

2010-03-13 Thread Tarek Ziadé

Tarek Ziadé ziade.ta...@gmail.com added the comment:

Roumen, I am moving all the new work in distutils into distutils2, and 
distutils is going to be frozen.

Do you want to work on this feature in distutils2 ? (which is distutils code 
base before I started to revert things)

Let me know so I mark this issue under Distutils2

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue3871
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8111] docs.python.org/download.html unhelpful.

2010-03-13 Thread Georg Brandl

Georg Brandl ge...@python.org added the comment:

Raising to release blocker status to get the changes that fix this and that 
are already in 2.6 approved by Barry.

The revisions are: r78907, r78914, r78923.

I'm attaching a patch with the collective diff.

In short, these changes mirror those done on the other active branches, which 
makes sure that all daily builds are done consistently.  Code is added only to 
the Doc Makefile and the download documentation template, both of which are 
not relevant to the released distribution.  Another rc is definitely not needed.

With these changes in place, we have:
- more consistent daily documentation builds (no longer coupled to the test 
runs by Neal)
- daily builds suspended for stable branches during the release process
- documentation downloads also for the development builds
- strict separation between released docs and daily updated docs

--
assignee: georg.brandl - barry
keywords: +patch
nosy: +barry
priority: high - release blocker
versions: +Python 2.5, Python 2.6, Python 2.7, Python 3.1, Python 3.2, Python 
3.3
Added file: http://bugs.python.org/file16535/26changes.diff

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue8111
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8107] test_distutils fails on Windows in 2.6.5rc2

2010-03-13 Thread Martin v . Löwis

Martin v. Löwis mar...@v.loewis.de added the comment:

The patch in its current form is incomplete: xxmodule.c won't end up on the 
target system, since msi.py doesn't package it. So that would need to be 
changed as well.

With the current release26-maint branch, test_distutils now passes, both with 
xxmodule.c present, and with it being absent. If it is present, test_distutils 
prints a number of additional output lines, starting with Creating library 


I also agree that the change is too heavy for the 2.6 maintenance release.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue8107
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8107] test_distutils fails on Windows in 2.6.5rc2

2010-03-13 Thread Tarek Ziadé

Tarek Ziadé ziade.ta...@gmail.com added the comment:

Ok then, I am applying Barry's suggestion right now in release26-maint then

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue8107
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8107] test_distutils fails on Windows in 2.6.5rc2

2010-03-13 Thread Tarek Ziadé

Tarek Ziadé ziade.ta...@gmail.com added the comment:

done in r78935.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue8107
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8102] test_distutils fails on 2.6.5rc1: No module named setuptools_build_ext

2010-03-13 Thread Tarek Ziadé

Tarek Ziadé ziade.ta...@gmail.com added the comment:

ok thanks for the tests Neal.

Martin, do I have to do soemthing in msi.py to see this file included ? (I am 
looking at msi.py right now and it looks like it has the proper glob, but I 
want to be 100% sure)

Ronald, what about the Mac OS scripts ?

--
nosy: +loewis

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue8102
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8102] test_distutils fails on 2.6.5rc1: No module named setuptools_build_ext

2010-03-13 Thread Martin v . Löwis

Martin v. Löwis mar...@v.loewis.de added the comment:

Tarek, in general, if you want a new file in Lib included, create a bug report 
and assign it to me.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue8102
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8133] test_imp fails on OS X 10.6; filename normalization issue.

2010-03-13 Thread Mark Dickinson

New submission from Mark Dickinson dicki...@gmail.com:

test_issue5604 from test_imp is currently failing on OS X !0.6 (py3k branch), 
with the following output:

==
ERROR: test_issue5604 (__main__.ImportTests)
--
Traceback (most recent call last):
  File Lib/test/test_imp.py, line 121, in test_issue5604
file, filename, info = imp.find_module(temp_mod_name)
ImportError: No module named test_imp_helper_ä

--


I think this has something to do with the platform automatically
using NFD normalization for filenames.  Here's an interactive session: 

Python 3.2a0 (py3k:78936, Mar 13 2010, 19:42:52) 
[GCC 4.2.1 (Apple Inc. build 5646) (dot 1)] on darwin
Type help, copyright, credits or license for more information.
 import imp, unicodedata
 fname = 'test' + b'\xc3\xa4'.decode('utf-8')
 with open(fname+'.py', 'w') as file: file.write('a = 1\n')
... 
6
 imp.find_module(fname)   # expected this to succeed
Traceback (most recent call last):
  File stdin, line 1, in module
ImportError: No module named testä
 imp.find_module(unicodedata.normalize('NFD', fname))
(_io.TextIOWrapper name=4 encoding='utf-8', 'testä.py', ('.py', 'U', 1))


In contrast, a simple 'open' doesn't seem to care about normalization:

 open(fname+'.py')
_io.TextIOWrapper name='testä.py' encoding='UTF-8'
[50305 refs]
 open(unicodedata.normalize('NFD', fname)+'.py')
_io.TextIOWrapper name='testä.py' encoding='UTF-8'
[50305 refs]

--
messages: 101018
nosy: ezio.melotti, mark.dickinson
severity: normal
status: open
title: test_imp fails on OS X 10.6; filename normalization issue.
type: behavior
versions: Python 3.2

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue8133
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8133] test_imp fails on OS X 10.6; filename normalization issue.

2010-03-13 Thread Mark Dickinson

Mark Dickinson dicki...@gmail.com added the comment:

Also affects 3.1.

--
versions: +Python 3.1

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue8133
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



  1   2   >