Re: Newbie naive question ... int() throws ValueError

2012-05-10 Thread Chris Angelico
On Fri, May 11, 2012 at 3:55 PM, John Terrak wrote: > I couldnt find anywhere in the documentation that int() can throw a > ValueError. > I checked the "The Python Language Reference", and the "The Python > Standard Library " to no avail. > Did I missed something? Unlike in Java, a function's li

Newbie naive question ... int() throws ValueError

2012-05-10 Thread John Terrak
Hi Sorry for such a naive question. I couldnt find anywhere in the documentation that int() can throw a ValueError. I checked the "The Python Language Reference", and the "The Python Standard Library " to no avail. Did I missed something? So here is the question - if it is not in the documentati

Re: Retrieving result from embedded execution

2012-05-10 Thread Stefan Behnel
F L, 08.05.2012 21:07: > We are trying to implement our own interactive interpreter in our > applicationusing an embedded Python interpreter. I was wondering what > would be the best way to retreive as text the result of executing > Python code. The text must be exactly the same as it would be in

Finding the line number of an 'else' statement via ast

2012-05-10 Thread Michael Rene Armida
Given this source: def do_something(val): if val: return 'a' else: return 'b' How do I get the line number of the "else:" line, using the ast module? The grammar only includes the 'orelse' list: If(expr test, stmt* body, stmt* orelse) ...but 'orelse' is the list of

Re: Retrieving result from embedded execution

2012-05-10 Thread Chris Angelico
On Wed, May 9, 2012 at 5:07 AM, F L wrote: > Hello everyone, > > We are trying to implement our own interactive interpreter in our > application > using an embedded Python interpreter. > > I was wondering what would be the best way to retreive as text the result of > executing Python code. The tex

Re: Open Source: you're doing it wrong - the Pyjamas hijack

2012-05-10 Thread Chris Angelico
On Fri, May 11, 2012 at 10:21 AM, Adrian Hunt wrote: > lol, Cheers Chris. > > Just so you know, I care about what and how I write... I almost always run > my emails though a word-processor before sending. And, that has paid off for > me: thanks to MS Word, MS Works and Open Office, I have better u

RE: Creating a Windows installer for Python + a set of dependencies

2012-05-10 Thread Adrian Hunt
Hi there, I've use NSIS for quite a few projects... NSIS will do it with ease. You write a script that gets "compiled" into a install exe and the scripting language is not too hard to learn. You can do it in several different ways: 1. You can include the Python installer as a file compressed i

RE: Open Source: you're doing it wrong - the Pyjamas hijack

2012-05-10 Thread Adrian Hunt
lol, Cheers Chris. Just so you know, I care about what and how I write... I almost always run my emails though a word-processor before sending. And, that has paid off for me: thanks to MS Word, MS Works and Open Office, I have better understanding of "correct" punctuation use (if not spelling

Re: Dealing with the __str__ method in classes with lots of attributes

2012-05-10 Thread Cameron Simpson
On 10May2012 15:33, Andreas Tawn wrote: | Say I've got a class... | | class test(object): | def __init__(self): | self.foo = 1 | self.bar = 2 | self.baz = 3 | | I can say... | | def __str__(self): |return "foo: {0}\nbar: {1}\nbaz: {2}".format(self.foo, self.bar,

Looking for video/slides from PyCon 2011...

2012-05-10 Thread Monte Milanuk
...specifically the two lectures on creating GUI applications with Python + QT http://us.pycon.org/2011/schedule/presentations/207/ Various searches on the 'Net don't seem to be turning up much... kinda curious as to why? Anyone here know? TIA, Monte -- http://mail.python.org/mailman/list

RE: Open Source: you're doing it wrong - the Pyjamas hijack

2012-05-10 Thread Adrian Hunt
Hi there, Yes, it's very messy by what I understand and is why Merlio never had it's judgements enforced. Although, employment contracts that were in place at the time (including mine), were declared null and void... I think it was something like: if a programmer has an idea and uses it with

Re: Open Source: you're doing it wrong - the Pyjamas hijack

2012-05-10 Thread Chris Angelico
On Fri, May 11, 2012 at 9:36 AM, Adrian Hunt wrote: > All I did was to answer a mail sent to me by Ian Kelly (who I don't konw nor > have ever had any prior contact with) about releasing code under a > license... And, what I said stands: once anyone releases code, they are > bound by the license t

RE: Open Source: you're doing it wrong - the Pyjamas hijack

2012-05-10 Thread Adrian Hunt
Hi ya, Please don't attack me or pull me into the centre of this conflict... I don't have any idea of what is really happening here; other than that I've read on the python-list mailing list. Your right, I have never released any code, under any license of any description. I have only offered

PyPI is being spammed

2012-05-10 Thread Ethan Furman
with Dr Sultan Spells of various natures. Can anybody put a stop to that? ~Ethan~ -- http://mail.python.org/mailman/listinfo/python-list

ANN: dbf version 0.92.002 released

2012-05-10 Thread Ethan Furman
Available at http://pypi.python.org/pypi/dbf Fixed issue with Memo fields not returning correct unicode data. Updated many docstrings. Nulls now fully supported. Getting closer to a 1.0 (non-beta!) release; working on PEP 8 compliance, index files, and actual documentation. Biggest change =

Re: Problem with time.time() standing still

2012-05-10 Thread Bob Cowdery
Hi Roel "Our problem turned out to be caused by a loss of precision in an application of ours, caused by Direct3D. The solution for us was to include the flag D3DCREATE_FPU_PRESERVE in CreateDevice(). The documentation seems to imply that the lower precision only has effect in the Direct3D code, b

Re: Dealing with the __str__ method in classes with lots of attributes

2012-05-10 Thread Chris Angelico
On Fri, May 11, 2012 at 1:15 AM, Andreas Tawn wrote: > I considered the triple quote string one, but it's not very PEP 8 compatible > in a real class because it includes the indentation in the formatted string. Yeah, that is an annoying side effect. My personal view is that code should be writte

Re: Mailing list assistance: manual unsubscribing of failed recipient?

2012-05-10 Thread Chris Angelico
On Fri, May 11, 2012 at 3:55 AM, Ned Deily wrote: > In article > , >  Chris Angelico wrote: >> Who is in charge of the list? Can pyjk...@azet.sk be unsubscribed manually? > > http://mail.python.org/mailman/listinfo/python-list Doh! I checked the top of that page ("We" this and "We" that) but did

Re: Help with how to combine two csv files

2012-05-10 Thread Sammy Danso
Hi JM and All, Thank you all very much for your response and help. I managed to work out the problem eventually. But my code is ridiculously long compared to what you have just offered here. I think your code is elegant and should be much faster.  Thanks  a lot Sammy   Below is my code.  

ANN: Intro+Intermediate Python, San Francisco, Aug 1-3

2012-05-10 Thread wesley chun
Greetings! I'll be doing another hardcore Python course this summer in the San Francisco area. If you're somewhat new to Python or have tinkered but want to fill-in the holes, this course is for you. It's somewhat true you can learn Python online, watching videos, or reading books, but it still ta

Re: Mailing list assistance: manual unsubscribing of failed recipient?

2012-05-10 Thread Ned Deily
In article , Chris Angelico wrote: > Who is in charge of the list? Can pyjk...@azet.sk be unsubscribed manually? http://mail.python.org/mailman/listinfo/python-list -- Ned Deily, n...@acm.org -- http://mail.python.org/mailman/listinfo/python-list

Re: Problem with time.time() standing still

2012-05-10 Thread Roel Schroeven
Hi Bob, This reminds of a problem we had at work some years ago. I've followed the thread from the beginning, but I hadn't a clue about what could possibly cause the problem until you said: Bob Cowdery schreef: Hopefully somebody can add the last piece of this puzzle. My code didn't work becaus

Re: parallel programming in Python

2012-05-10 Thread Michael Torrie
On 05/10/2012 06:46 AM, Devin Jeanpierre wrote: > On Thu, May 10, 2012 at 8:14 AM, Jabba Laci wrote: >> What's the best way? > >>From what I've heard, http://scrapy.org/ . It is a single-thread > single-process web crawler that nonetheless can download things > concurrently. Yes, for i/o bound t

Running embedded python shell on a separate thread

2012-05-10 Thread Roel van de Kraats
For those who are interested, In an application I am working on, an embedded python shell needs to be run on a separate thread, since the main thread is already 'taken' (by Qt). This causes an issue with handling SIGINT (Control-C) when using the readline package; the 'KeyboardInterrupt' is on

RE: Dealing with the __str__ method in classes with lots of attributes

2012-05-10 Thread Andreas Tawn
> On Thu, May 10, 2012 at 11:33 PM, Andreas Tawn > wrote: > > Say I've got a class... > > > > class test(object): > >    def __init__(self): > >        self.foo = 1 > >        self.bar = 2 > >        self.baz = 3 > > > > I can say... > > > > def __str__(self): > >   return "foo: {0}\nbar: {1}\nbaz

Re: Dealing with the __str__ method in classes with lots of attributes

2012-05-10 Thread Chris Angelico
On Thu, May 10, 2012 at 11:33 PM, Andreas Tawn wrote: > Say I've got a class... > > class test(object): >    def __init__(self): >        self.foo = 1 >        self.bar = 2 >        self.baz = 3 > > I can say... > > def __str__(self): >   return "foo: {0}\nbar: {1}\nbaz: {2}".format(self.foo, self

Creating a Windows installer for Python + a set of dependencies

2012-05-10 Thread Giampaolo Rodolà
Hi all, I need to create an installer for Windows which should be able to install a specific version of the Python interpreter (2.7) plus a set a dependencies such as ipython, numpy, pandas, etc. Basically this is the same thing Active State did for their Active Python distribution: a single bundle

Re: Python SOAP library

2012-05-10 Thread John
W dniu 2012-05-02 17:35, Alec Taylor pisze: Would you recommend: http://code.google.com/p/soapbox/ Or suggest another? I am having lots of fun and positive experience with https://github.com/arskom/rpclib Awesome doc and example code and, most importantly, it works! :) -- John -- http://mail

Dealing with the __str__ method in classes with lots of attributes

2012-05-10 Thread Andreas Tawn
Say I've got a class... class test(object): def __init__(self): self.foo = 1 self.bar = 2 self.baz = 3 I can say... def __str__(self): return "foo: {0}\nbar: {1}\nbaz: {2}".format(self.foo, self.bar, self.baz) and everything's simple and clean and I can vary the f

Re: Pydev configuration

2012-05-10 Thread Andrew Berg
On 5/9/2012 4:25 PM, Alan Ristow wrote: > Select the code block you want to indent and hit Tab. To do the reverse, > hit Shift-Tab. You can also select a code block and choose "Shift Right" or "Shift Left" from the context menu. -- CPython 3.3.0a3 | Windows NT 6.1.7601.17790 -- http://mail.pyth

Re: parallel programming in Python

2012-05-10 Thread Jabba Laci
Hi, Thanks for the answer. I use Linux with CPython 2.7. I plan to work with CPU bound and I/O bound problems too. Which packages to use in these cases? Could you redirect me to some guides? When to use multiprocessing / gevent? Thanks, Laszlo On Thu, May 10, 2012 at 2:34 PM, Dave Angel wrote

Re: parallel programming in Python

2012-05-10 Thread Devin Jeanpierre
On Thu, May 10, 2012 at 8:14 AM, Jabba Laci wrote: > What's the best way? >From what I've heard, http://scrapy.org/ . It is a single-thread single-process web crawler that nonetheless can download things concurrently. Doing what you want in Scrapy would probably involve learning about Twisted, t

Re: parallel programming in Python

2012-05-10 Thread Dave Angel
On 05/10/2012 08:14 AM, Jabba Laci wrote: > Hi, > > I would like to do some parallel programming with Python but I don't > know how to start. There are several ways to go but I don't know what > the differences are between them: threads, multiprocessing, gevent, > etc. > > I want to use a single ma

parallel programming in Python

2012-05-10 Thread Jabba Laci
Hi, I would like to do some parallel programming with Python but I don't know how to start. There are several ways to go but I don't know what the differences are between them: threads, multiprocessing, gevent, etc. I want to use a single machine with several cores. I want to solve problems like

Re: __doc__+= """Detailed description"""

2012-05-10 Thread Jean-Michel Pichavant
Pierre Asselin wrote: Hi. Started using python a few months back, still settling on my style. I write docstrings and I use "pydoc mymodule" to refresh my memory. Problem: if I just docstring my classes/methods/functions the output of pydoc more or less works as a reference manual, but if I get

Re: Real time event accuracy

2012-05-10 Thread Mark Lawrence
On 09/05/2012 16:52, Tobiah wrote: I'd like to send MIDI events from python to another program. I'd like advice as to how to accurately time the events. I'll have a list of floating point start times in seconds for the events, and I'd like to send them off as close to the correct time as possib

Re: Real time event accuracy

2012-05-10 Thread John O'Hagan
On Wed, 09 May 2012 08:52:59 -0700 Tobiah wrote: > I'd like to send MIDI events from python to another > program. I'd like advice as to how to accurately > time the events. I'll have a list of floating point > start times in seconds for the events, and I'd like to send them > off as close to th

Re: __doc__+= """Detailed description"""

2012-05-10 Thread Steven D'Aprano
On Thu, 10 May 2012 02:36:29 +, Pierre Asselin wrote: > Hi. Started using python a few months back, still settling on my style. > I write docstrings and I use "pydoc mymodule" to refresh my memory. > > Problem: if I just docstring my classes/methods/functions the output of > pydoc more or l

Uploaded package not pip installable

2012-05-10 Thread James Pic
Hello everybody, I uploaded a couple of packages: - http://pypi.python.org/pypi/django-cities-light/1.0 - http://pypi.python.org/pypi/django-autocomplete-light/0.1 But they are not pip installable: <<< 10:12.00 Thu May 10 2012!~ <<< jpic@germaine!10012 E:1 env >>> pip install django-autocomple

Re: Mailing list assistance: manual unsubscribing of failed recipient?

2012-05-10 Thread Chris Angelico
On Thu, May 10, 2012 at 3:21 PM, Cameron Simpson wrote: > On 10May2012 13:13, Chris Angelico wrote: > | The azet.sk MTA is behaving badly wrt bounced messages from > | python-list. Instead of sending them to the list software (where > | they'll result in the subscription being suspended), they're

2to3 change direct import to relative import

2012-05-10 Thread Vincent Vande Vyvre
Hi, I use 2to3 into a python script wich convert all .py files of an application. 2to3 is executed into the same directory as files. All import are now relative import: - --- main_ui.py (original) +++ main_ui.py (refactored) @@ -15,18 +15,18 @@ -from ui

Distutils2 Sprint in Montreal

2012-05-10 Thread Éric Araujo
Hi all, The Montreal-Python user group is organizing a second sprint to work on distutils2 on May 12th. If you live in Montreal, take a laptop and come join us! No previous knowledge of Distutils2 is required, just general Python skills. All details are found here: http://montrealpy