From the crest of Olivet...

2012-04-16 Thread E Bmums
"From the crest of Olivet, Jesus looked upon Jerusalem. Fair and peaceful was the scene spread out before Him. It was the season of the Passover, and from all lands the children of Jacob had gathered there to celebrate the great national festival. In the midst of gardens and vineyards, and gre

PrintPreviewDialog problem

2012-04-16 Thread alhad
Hi Guys, I am using Python 2.5 & Qt4.4.1 on windows xp machine. I am trying to use printpreviewdialog for my application. printer = QtGui.QPrinter(QtGui.QPrinter.HighResolution) preview = QtGui.QPrintPreviewDialog(printer,self) preview.paintRequested.connect(self.printPreview) preview.exec_() bu

Re: Get stack trace from C

2012-04-16 Thread Stefan Behnel
Eric Frederich, 16.04.2012 20:14: > I embed Python in a 3rd party application. > I need to use their conventions for errors. > > Looking here... > http://docs.python.org/extending/embedding.html#pure-embedding > the example uses PyErr_Print() but that goes to stdout or stderr or > somethin

Re: python module

2012-04-16 Thread MRAB
On 17/04/2012 01:21, Chris Angelico wrote: On Tue, Apr 17, 2012 at 9:43 AM, Mark Lawrence wrote: I'd like to point out that it's frustrating when you find a piece of code that you'd like to use but neither easy_install nor pip work cos it can't be found. Worse still when you want to try a r

Re: python module

2012-04-16 Thread Kiuhnm
On 4/17/2012 1:23, Steven D'Aprano wrote: [...] Wherever you host the code itself, you should also register it on PyPI. Ok, thanks. Kiuhnm -- http://mail.python.org/mailman/listinfo/python-list

Re: python module

2012-04-16 Thread Chris Angelico
On Tue, Apr 17, 2012 at 9:43 AM, Mark Lawrence wrote: > I'd like to point out that it's frustrating when you find a piece of code > that you'd like to use but neither easy_install nor pip work cos it can't be > found.  Worse still when you want to try a really popular product like > taskcoach, but

Re: escaping

2012-04-16 Thread Steven D'Aprano
On Mon, 16 Apr 2012 23:27:04 +, Steven D'Aprano wrote: > On Mon, 16 Apr 2012 23:12:52 +, Steven D'Aprano wrote: > >> But it does. Before making assumptions about what format does and does >> not offer, remember that the Fine Manual is your friend. > > Ha, it would help if I remembered to

Re: python module

2012-04-16 Thread Mark Lawrence
On 17/04/2012 00:23, Steven D'Aprano wrote: On Mon, 16 Apr 2012 12:23:14 +0200, Kiuhnm wrote: I'd like to share a module of mine with the Python community. I'd like to encourage bug reports, suggestions, etc... Where should I upload it to? Kiuhnm PyPI, unofficially known as the cheeseshop, i

Re: how to count the total number of strings (in the list) used in Python?

2012-04-16 Thread Dave Angel
Did you have a reason to spam us with a second copy of the message after only 3 minutes? Usually, you should wait a few days, and then REPLY to the earlier one, don't leave another with the same subject. The way you did it, some people might respond to one, and some to the other, creating two sep

Re: escaping

2012-04-16 Thread Mark Lawrence
On 16/04/2012 11:03, Kiuhnm wrote: I like this one. Since I read somewhere that 'format' is preferred over '%', I was focusing on 'format' and I didn't think of '%'. Anyway, it's odd that 'format' doesn't offer something similar. Kiuhnm This was the original intention, i.e. 'format' preferred

Re: escaping

2012-04-16 Thread Steven D'Aprano
On Mon, 16 Apr 2012 23:12:52 +, Steven D'Aprano wrote: > But it does. Before making assumptions about what format does and does > not offer, remember that the Fine Manual is your friend. Ha, it would help if I remembered to link to the manual... sorry about that. http://docs.python.org/libr

Re: python module

2012-04-16 Thread Steven D'Aprano
On Mon, 16 Apr 2012 12:23:14 +0200, Kiuhnm wrote: > I'd like to share a module of mine with the Python community. I'd like > to encourage bug reports, suggestions, etc... Where should I upload it > to? > > Kiuhnm PyPI, unofficially known as the cheeseshop, is the semi-official place for third-p

Re: escaping

2012-04-16 Thread Steven D'Aprano
On Mon, 16 Apr 2012 12:03:31 +0200, Kiuhnm wrote: > On 4/16/2012 4:42, Steven D'Aprano wrote: >> On Sun, 15 Apr 2012 23:07:36 +0200, Kiuhnm wrote: >> >>> This is the behavior I need: >>> path = path.replace('\\', '') >>> msg = ". {} .. '{}' .. {} .".format(a, path, b) >>> Is there

Re: how to count the total number of strings (in the list) used in Python?

2012-04-16 Thread Chris Angelico
On Tue, Apr 17, 2012 at 5:03 AM, Chinesekidz wrote: > Hello! > > I would like to know how to write the program to count the total > number of strings (in the list) used in Python.. > > for example: > [broken example snipped] > in the case above, it is to show the how many times of strings from > t

Re: Naming future objects and their methods

2012-04-16 Thread Mark Lawrence
On 16/04/2012 20:58, Stefan Schwarzer wrote: Hello, Here's a summary of the messages which reached me in this newsgroup and by e-mail. They are ordered by the time they reached me at. (According to the headers, each of the answers went to either comp.lang.python or python-list@python.org . I th

Re: logging.config.fileConfig FileHandler configure to write to APP_DATA

2012-04-16 Thread Jeffrey Britton
I figured out what I was after. logfn = os.path.join(os.environ['APPDATA'], directory, filename) ensure_path(logfn) logging.config.fileConfig("logging.conf", defaults={'logfn': logfn}) In the config file use: [handler_fileHandler] class=FileHandler level=DEBUG formatter=simpleFormatter args=(r'%(

Re: Python one-liner?

2012-04-16 Thread Ian Kelly
On Mon, Apr 16, 2012 at 3:18 PM, Karl Knechtel wrote: > d = {k: list(v) for k, v in itertools.groupby(sorted(l, key=f), f)} Note that the sorted call would fail if f returns objects of unorderable types: Python 3.2 (r32:88445, Feb 20 2011, 21:29:02) [MSC v.1500 32 bit (Intel)] on win32 Type "hel

Re: logging.config.fileConfig FileHandler configure to write to APP_DATA

2012-04-16 Thread Jeffrey Britton
I figured out a method to enumerate all loggers. root = logging.getLogger() for key in root.manager.loggerDict.keys(): logger = logging.getLogger(key) -- http://mail.python.org/mailman/listinfo/python-list

Fwd: Python one-liner?

2012-04-16 Thread Karl Knechtel
On Sat, Apr 14, 2012 at 7:26 AM, Tim Chase wrote: > > On 04/13/12 22:54, Chris Angelico wrote: >> >> Yes, that would be the right method to use. I'd not bother with the >> function and map() though, and simply iterate: >> >> d = {} >> for val in l: >>  d.setdefault(f(val), []).append(val) > > > Or

logging.config.fileConfig FileHandler configure to write to APP_DATA

2012-04-16 Thread Jeffrey Britton
I have a logging configuration file that I load via logging.config.fileConfig. The configuration file, configures a FileHandler to log to file. I wish to initialize the FileHandler to the path os.environ['APP_DATA']. However, I don't know how to configure anything other than a static path. I also

Re: Whither paramiko?

2012-04-16 Thread Matej Cepl
On 15.4.2012 15:42, Bryan wrote: Paramiko is a Python library for SSH (Secure Shell). Over about the last year, I've grown dependent upon it. Its home page is still easy to search up, but the links to its mailing list and repository don't work. Paramiko depends on PyCrypto, and not so long ago t

Re: File traversing

2012-04-16 Thread Karl Knechtel
On Sun, Apr 15, 2012 at 5:51 AM, Chris Angelico wrote: > > (You may also want to consider using the 'with' statement to guarantee > a timely closing of the file. Outside the scope of this mail though.) > > I think this list is just to collect unique entries, yes? If so, a set > may be more to you

RE: Advise of programming one of my first programs

2012-04-16 Thread Prasad, Ramit
> Ramit, > > This seems to be more logic now "I hope" :) > # > import ast > fname = 0 > lname = 1 > country = 2 > city = 3 > tel = 4 > notes = 5 > > ## Read data from file > > def load_book(): >     load_book = open('c:/Python27/Toli/myfile.txt', 'r') >  

RE: How to stop the program as soon as one of the condition is met

2012-04-16 Thread Rob Richardson
Please show us your code. RobR -- http://mail.python.org/mailman/listinfo/python-list

Re: Donald E. Knuth in Python, cont'd

2012-04-16 Thread Tim Daneliuk
On 04/11/2012 03:20 PM, John Nagle wrote: On 4/11/2012 6:03 AM, Antti J Ylikoski wrote: I wrote about a straightforward way to program D. E. Knuth in Python, and received an excellent communcation about programming Deterministic Finite Automata (Finite State Machines) in Python. The following

Re: Naming future objects and their methods

2012-04-16 Thread Stefan Schwarzer
Hello, Here's a summary of the messages which reached me in this newsgroup and by e-mail. They are ordered by the time they reached me at. (According to the headers, each of the answers went to either comp.lang.python or python-list@python.org . I thought there was some kind of gateway, but in my

Re: How to stop the program as soon as one of the condition is met

2012-04-16 Thread Chris Rebert
On Mon, Apr 16, 2012 at 12:06 PM, Chinesekidz wrote: > Hello Guys: > > How can I stop the program as soon as one of the condition is met? > > > Here is example: > > The loop should be stop asking for more input if a=b or c=6. > > I tried to write one but it only stop when a=b and not when c=6 Ple

How to stop the program as soon as one of the condition is met

2012-04-16 Thread Chinesekidz
Hello Guys: How can I stop the program as soon as one of the condition is met? Here is example: The loop should be stop asking for more input if a=b or c=6. I tried to write one but it only stop when a=b and not when c=6 Please help me -- http://mail.python.org/mailman/listinfo/python-li

how to count the total number of strings (in the list) used in Python?

2012-04-16 Thread Chinesekidz
Hello! I would like to know how to write the program to count the total number of strings (in the list) used in Python.. for example: list:['1','2','3','4'] for l in range(4): num=input("list:"+list[l]+"(between 1 and 4):") if num.isdigit: tnum=tnum+int(num) print("Total numb

how to count the total number of strings (in the list) used in Python?

2012-04-16 Thread Chinesekidz
Hello! I would like to know how to write the program to count the total number of strings (in the list) used in Python.. for example: list:['1','2','3','4'] for l in range(4): num=input("list:"+list[l]+"(between 1 and 4):") if num.isdigit: tnum=tnum+int(num) print("Total numb

Re: pygame: output to file?

2012-04-16 Thread Ian Kelly
On Mon, Apr 16, 2012 at 12:39 PM, Temia Eszteri wrote: > If there's a image-handling library out there for Python that can make > animated GIFs, I might be able to come up with a faster and more > internalized solution using surface.convert() to paletted modes and > image.tostring() functions or s

Re: pygame: output to file?

2012-04-16 Thread Temia Eszteri
On Mon, 16 Apr 2012 12:48:37 -0400, you wrote: >On 4/16/2012 8:37 AM, superpollo wrote: >> alex23 ha scritto: >>> On Apr 16, 7:34 pm, superpollo wrote: is there a way to convert the graphical output of a pygame application to a mpeg file or better an animated gif? i mean, not using an e

Get stack trace from C

2012-04-16 Thread Eric Frederich
I embed Python in a 3rd party application. I need to use their conventions for errors. Looking here... http://docs.python.org/extending/embedding.html#pure-embedding ...the example uses PyErr_Print() but that goes to stdout or stderr or something. I need to put the error somewhere else. How

Re: python module

2012-04-16 Thread Kiuhnm
On 4/16/2012 13:02, Thomas Rachel wrote: Am 16.04.2012 12:23 schrieb Kiuhnm: I'd like to share a module of mine with the Python community. I'd like to encourage bug reports, suggestions, etc... Where should I upload it to? Kiuhnm There are several ways to do this. One of them would be bitbuck

Re: Pyjamas 0.8.1~+alpha1 released

2012-04-16 Thread Terry Reedy
On 4/16/2012 5:21 AM, Luke Kenneth Casson Leighton wrote: This is the 0.8.1~+alpha1 release of Pyjamas. Pyjamas comprises several projects, one of which is a stand-alone python-to-javascript compiler; other projects include a Graphical Widget Toolkit, such that pyjamas applications can run eithe

Re: pygame: output to file?

2012-04-16 Thread Terry Reedy
On 4/16/2012 8:37 AM, superpollo wrote: alex23 ha scritto: On Apr 16, 7:34 pm, superpollo wrote: is there a way to convert the graphical output of a pygame application to a mpeg file or better an animated gif? i mean, not using an external capture program... There is, but it's probably not g

Re: escaping

2012-04-16 Thread Kiuhnm
On 4/16/2012 17:14, Jon Clements wrote: On Monday, 16 April 2012 11:03:31 UTC+1, Kiuhnm wrote: On 4/16/2012 4:42, Steven D'Aprano wrote: On Sun, 15 Apr 2012 23:07:36 +0200, Kiuhnm wrote: This is the behavior I need: path = path.replace('\\', '') msg = ". {} .. '{}' .. {} ."

Re: Making helper methods more concise

2012-04-16 Thread Terry Reedy
On 4/16/2012 8:01 AM, Alan Ristow wrote: Hi all, I have defined a class that includes a number of helper methods that are useful to me, but pretty redundant. Something like so, where I maintain a list of tuples: class A(object): def __init__(self): self.listing = [] # This m

Re: contributing to sqlite documentation

2012-04-16 Thread Terry Reedy
On 4/16/2012 4:12 AM, Pedro Larroy wrote: I would like to contribute to this documentation http://docs.python.org/library/sqlite3.html > Can somebody point me how to best do it? Documentations improvement sometimes start with discussion on this list. Both code and documentation issues are hand

Re: system call that is killed after n seconds if not finished

2012-04-16 Thread Alain Ketterlin
Jaroslav Dobrek writes: > I would like to execute shell commands, but only if their execution > time is not longer than n seconds. Like so: > > monitor(os.system("do_something"), 5) > > I.e. the command do_somthing should be executed by the operating > system. If the call has not finished after 5

Re: system call that is killed after n seconds if not finished

2012-04-16 Thread Benjamin Kaplan
On Mon, Apr 16, 2012 at 10:51 AM, Jaroslav Dobrek wrote: > > Hello, > > I would like to execute shell commands, but only if their execution > time is not longer than n seconds. Like so: > > monitor(os.system("do_something"), 5) > > I.e. the command do_somthing should be executed by the operating >

Re: escaping

2012-04-16 Thread Jon Clements
On Monday, 16 April 2012 11:03:31 UTC+1, Kiuhnm wrote: > On 4/16/2012 4:42, Steven D'Aprano wrote: > > On Sun, 15 Apr 2012 23:07:36 +0200, Kiuhnm wrote: > > > >> This is the behavior I need: > >> path = path.replace('\\', '') > >> msg = ". {} .. '{}' .. {} .".format(a, path, b) > >

Re: python module

2012-04-16 Thread Chris Angelico
On Mon, Apr 16, 2012 at 8:23 PM, Kiuhnm wrote: > I'd like to share a module of mine with the Python community. I'd like to > encourage bug reports, suggestions, etc... > Where should I upload it to? Are you planning to open source it? If so, I would recommend using one of the version-control host

system call that is killed after n seconds if not finished

2012-04-16 Thread Jaroslav Dobrek
Hello, I would like to execute shell commands, but only if their execution time is not longer than n seconds. Like so: monitor(os.system("do_something"), 5) I.e. the command do_somthing should be executed by the operating system. If the call has not finished after 5 seconds, the process should b

Re: Possible change to logging.handlers.SysLogHandler

2012-04-16 Thread Vinay Sajip
Vinay Sajip yahoo.co.uk> writes: > I am thinking of removing the BOM insertion in 2.7 and 3.2 - although > it is a change in behaviour, the current behaviour does seem broken > with regard to RFC 5424 conformance. However, as some might disagree > with that assessment and view it as a backwards-i

Re: pygame: output to file?

2012-04-16 Thread superpollo
superpollo ha scritto: alex23 ha scritto: On Apr 16, 7:34 pm, superpollo wrote: is there a way to convert the graphical output of a pygame application to a mpeg file or better an animated gif? i mean, not using an external capture program... There is, but it's probably not going to be as per

Re: pygame: output to file?

2012-04-16 Thread superpollo
alex23 ha scritto: On Apr 16, 7:34 pm, superpollo wrote: is there a way to convert the graphical output of a pygame application to a mpeg file or better an animated gif? i mean, not using an external capture program... There is, but it's probably not going to be as performant as using somethi

Re: Making helper methods more concise

2012-04-16 Thread Arnaud Delobelle
On 16 April 2012 13:29, Arnaud Delobelle wrote: > You can do this (untested), but no doubt it won't be to everybody's taste: > > class A(object): >   def __init__(self): >       self.listing = [] > >   # This method does the work. >   def append_text(self, text, style): >       self.listing.append

Re: Making helper methods more concise

2012-04-16 Thread Arnaud Delobelle
On 16 April 2012 13:01, Alan Ristow wrote: > Hi all, > > I have defined a class that includes a number of helper methods that > are useful to me, but pretty redundant. Something like so, where I > maintain a list of tuples: > > class A(object): >    def __init__(self): >        self.listing = [] >

Re: File traversing

2012-04-16 Thread Nibin V M
Thank you Chris :) ..I will check it... On Sun, Apr 15, 2012 at 3:21 PM, Chris Angelico wrote: > On Sun, Apr 15, 2012 at 7:15 PM, Nibin V M wrote: > > res_own_file = open('/bah') > > res_own_list = res_own_file.readline() > > res_tot_list=[] > > while res_own_list: > > res_own_list=res_own_li

Making helper methods more concise

2012-04-16 Thread Alan Ristow
Hi all, I have defined a class that includes a number of helper methods that are useful to me, but pretty redundant. Something like so, where I maintain a list of tuples: class A(object): def __init__(self): self.listing = [] # This method does the work. def append_text(self,

Re: escaping

2012-04-16 Thread Serhiy Storchaka
16.04.12 00:07, Kiuhnm написав(ла): path = path.replace('\\', '') If you think that it is too complicated: path = re.sub('', '', path) -- http://mail.python.org/mailman/listinfo/python-list

Re: pygame: output to file?

2012-04-16 Thread alex23
On Apr 16, 7:34 pm, superpollo wrote: > is there a way to convert the graphical output of a pygame application > to a mpeg file or better an animated gif? i mean, not using an external > capture program... There is, but it's probably not going to be as performant as using something external: htt

Re: python module

2012-04-16 Thread Thomas Rachel
Am 16.04.2012 12:23 schrieb Kiuhnm: I'd like to share a module of mine with the Python community. I'd like to encourage bug reports, suggestions, etc... Where should I upload it to? Kiuhnm There are several ways to do this. One of them would be bitbucket. Thomas -- http://mail.python.org/mai

Re: escaping

2012-04-16 Thread Kiuhnm
On 4/16/2012 12:03, Kiuhnm wrote: On 4/16/2012 4:42, Steven D'Aprano wrote: On Sun, 15 Apr 2012 23:07:36 +0200, Kiuhnm wrote: This is the behavior I need: path = path.replace('\\', '') msg = ". {} .. '{}' .. {} .".format(a, path, b) Is there a better way? This works for me: a = "spam"

python module

2012-04-16 Thread Kiuhnm
I'd like to share a module of mine with the Python community. I'd like to encourage bug reports, suggestions, etc... Where should I upload it to? Kiuhnm -- http://mail.python.org/mailman/listinfo/python-list

Re: escaping

2012-04-16 Thread Peter Otten
Kiuhnm wrote: > On 4/16/2012 4:42, Steven D'Aprano wrote: >> On Sun, 15 Apr 2012 23:07:36 +0200, Kiuhnm wrote: >> >>> This is the behavior I need: >>> path = path.replace('\\', '') >>> msg = ". {} .. '{}' .. {} .".format(a, path, b) >>> Is there a better way? >> >> >> This works fo

Re: escaping

2012-04-16 Thread Kiuhnm
On 4/16/2012 4:42, Steven D'Aprano wrote: On Sun, 15 Apr 2012 23:07:36 +0200, Kiuhnm wrote: This is the behavior I need: path = path.replace('\\', '') msg = ". {} .. '{}' .. {} .".format(a, path, b) Is there a better way? This works for me: a = "spam" b = "ham" path = r"C:\

Re: [newbie questions] if conditions - if isset - if empty

2012-04-16 Thread Jean-Michel Pichavant
Mahmoud Abdel-Fattah wrote: Hello, I'm coming from PHP background ant totally new to Python, I just started using scrapy, but has some generic question in python. 1. How can I write the following code in easier way in Python ? if len(item['description']) > 0: item['description'] =

pygame: output to file?

2012-04-16 Thread superpollo
HI. is there a way to convert the graphical output of a pygame application to a mpeg file or better an animated gif? i mean, not using an external capture program... bye -- http://mail.python.org/mailman/listinfo/python-list

Re: Naming future objects and their methods

2012-04-16 Thread Jean-Michel Pichavant
Stefan Schwarzer wrote: Hello, I wrote a `Connection` class that can be found at [1]. A `Connection` object has a method `put_bytes(data)` which returns a "future" [2]. The data will be sent asynchronously by a thread attached to the connection object. The future object returned by `put_bytes`

Re: Python Gotcha's?

2012-04-16 Thread Mark Lawrence
On 16/04/2012 06:34, Steven D'Aprano wrote: The situation is worse on Windows, as Windows doesn't support hash-bang syntax. But that is being looked at now: http://www.python.org/dev/peps/pep-0397/ which should make supporting multiple Python versions much more pleasant Real Soon Now. No Rea

Pyjamas 0.8.1~+alpha1 released

2012-04-16 Thread Luke Kenneth Casson Leighton
This is the 0.8.1~+alpha1 release of Pyjamas. Pyjamas comprises several projects, one of which is a stand-alone python-to-javascript compiler; other projects include a Graphical Widget Toolkit, such that pyjamas applications can run either in web browsers as pure javascript (with no plugins requir

Re: Python Gotcha's?

2012-04-16 Thread Paul Rubin
rusi writes: > Costs can be single-cased (s) -- basically those that can be handled > by a 2to3 module You can't really 2to3 a large python application and expect to then just start using it without further attention or testing. You may have to do a fairly complete (i.e. expensive) QA and qualif

Re: Python Gotcha's?

2012-04-16 Thread rusi
On Apr 16, 11:44 am, Bryan wrote: > Steven D'Aprano wrote: > > And how is that different from any other two versions of Python? > > Python 3.0, also known as “Python 3000” or “Py3K”, is the first ever > *intentionally backwards incompatible* Python release. --GVR > > > Unless both versions include

sort by column a csv file case insensitive

2012-04-16 Thread Lee Chaplin
Well, if I have a file like this one: EWIENER, edit, edgard, evan, erick, elliott,