Re: How can I catch segmentation fault in python?

2010-11-16 Thread John Nagle
On 11/16/2010 10:15 PM, swapnil wrote: On Nov 17, 10:26 am, justin wrote: Hi all, I am calling a program written in C inside Python using ctypes, and it seems that sometimes the program in C crashes while it's being used in Python. Even under the circumstances, I want to get the Python program

Re: Is Unladen Swallow dead?

2010-11-16 Thread John Nagle
On 11/16/2010 10:24 PM, swapnil wrote: On Nov 17, 3:30 am, laspi wrote: There has been little or no activity at all in this project in the last months, and the last comments on their mailing list seem to conrfim that it's future is uncertain. It's also very strange the lack of updates, news or

Re: How can I catch segmentation fault in python?

2010-11-16 Thread Chris Rebert
On Tue, Nov 16, 2010 at 9:26 PM, justin wrote: > Hi all, > > I am calling a program written in C inside Python using ctypes, > and it seems that sometimes the program in C crashes while it's being > used in Python. > Even under the circumstances, I want to get the Python program going > by handlin

Re: strange subprocess behavior when calling ps

2010-11-16 Thread Roger Davis
Thanks, Ned! That really helps to explain what is going on. Now, just a couple more questions and I think I will know all I need to know. First, I *still* don't quite understand why this happens with my 2.6.6 interpreter but not my 2.6.1, and why another of the respondents to this thread (Chris) c

Re: Is Unladen Swallow dead?

2010-11-16 Thread swapnil
On Nov 17, 3:30 am, laspi wrote: > There has been little or no activity at all in this project in the > last months, and the last comments on their mailing list seem to > conrfim that it's future is uncertain. > It's also very strange the lack of updates, news or discussions, > specially consideri

Re: How can I catch segmentation fault in python?

2010-11-16 Thread swapnil
On Nov 17, 10:26 am, justin wrote: > Hi all, > > I am calling a program written in C inside Python using ctypes, > and it seems that sometimes the program in C crashes while it's being > used in Python. > Even under the circumstances, I want to get the Python program going > by handling the segmen

Re: remote server and effective uid

2010-11-16 Thread Dan Stromberg
On Tue, Nov 16, 2010 at 9:37 AM, Tim Arnold wrote: > "Tim Harig" wrote in message > news:ibs8h9$jm...@speranza.aioe.org... > > On 2010-11-15, Tim Arnold wrote: > >> On Nov 15, 10:41 am, Tim Harig wrote: > >>> On 2010-11-15, Tim Arnold wrote: > >>> > >>> > How can I enable the server process t

How can I catch segmentation fault in python?

2010-11-16 Thread justin
Hi all, I am calling a program written in C inside Python using ctypes, and it seems that sometimes the program in C crashes while it's being used in Python. Even under the circumstances, I want to get the Python program going by handling the segmentation fault. I've already searched the Internet

Re: Raw Unicode docstring

2010-11-16 Thread John Machin
On Nov 17, 9:34 am, Alexander Kapps wrote: >  >>> ur"Scheißt\nderBär\nim Wald?" Nicht ohne eine Genehmigung von der Umwelt Erhaltung Abteilung. -- http://mail.python.org/mailman/listinfo/python-list

Re: remote server and effective uid

2010-11-16 Thread Tim Arnold
"Tim Harig" wrote in message news:ibs8h9$jm...@speranza.aioe.org... > On 2010-11-15, Tim Arnold wrote: >> On Nov 15, 10:41 am, Tim Harig wrote: >>> On 2010-11-15, Tim Arnold wrote: >>> >>> > How can I enable the server process to write into the client's >>> > directories? >>> > If I change the

Re: how to use socket to get packet which destination ip is not local?

2010-11-16 Thread c_c
libpcap On Wed, Nov 17, 2010 at 4:57 AM, MRAB wrote: > On 16/11/2010 20:38, Hans wrote: > >> Hi, >> >> Maybe it's a very simple question. I'm trying to write a dhcpclient >> code with python. The dhcpclient does not have ip address at the very >> beginning, it sends out dhcpdiscover and then ser

Re: strange subprocess behavior when calling ps

2010-11-16 Thread Roger Davis
Hi James, Thanks for the pointer to psutil. I actually did look around on python.org before coding this up to see if there was such a package available but there is not, at least not where I'm looking -- on the other hand, I can't find my car keys most of the time. I would really like to restrict

Re: strange subprocess behavior when calling ps

2010-11-16 Thread Ned Deily
In article <55f26d5c-aba9-4892-9e2c-1caa9988e...@v23g2000vbi.googlegroups.com>, Roger Davis wrote: > I have encountered a strange problem with some code I am writing to > search the system process list for certain running processes. I am > using subprocess.Popen() to call '/bin/ps -e'. When I sa

Re: how to use socket to get packet which destination ip is not local?

2010-11-16 Thread Hans
On Nov 16, 12:57 pm, MRAB wrote: > On 16/11/2010 20:38, Hans wrote: > > > Hi, > > > Maybe it's a very simple question. I'm trying to write a dhcpclient > > code with python. The dhcpclient does not have ip address at the very > > beginning, it sends out dhcpdiscover and then server sends back > >

Re: strange subprocess behavior when calling ps

2010-11-16 Thread Roger Davis
Thanks, Chris, you're at least on the right track. I did upgrade from python.org and the python in my shell PATH is /Library/Frameworks/ Python.framework/Versions/2.6/bin/python: % python Python 2.6.6 (r266:84374, Aug 31 2010, 11:00:51) [GCC 4.0.1 (Apple Inc. build 5493)] on darwin /usr/bin/pytho

Re: strange subprocess behavior when calling ps

2010-11-16 Thread Chris Rebert
On Tue, Nov 16, 2010 at 6:33 PM, Roger Davis wrote: > Hi all, > > I have encountered a strange problem with some code I am writing to > search the system process list for certain running processes. I am > using subprocess.Popen() to call '/bin/ps -e'. When I save my code to > the file pid.py (whos

Re: strange subprocess behavior when calling ps

2010-11-16 Thread James Mills
On Wed, Nov 17, 2010 at 12:33 PM, Roger Davis wrote: > Hi all, > > I have encountered a strange problem with some code I am writing to > search the system process list for certain running processes. I am > using subprocess.Popen() to call '/bin/ps -e'. When I save my code to > the file pid.py (who

strange subprocess behavior when calling ps

2010-11-16 Thread Roger Davis
Hi all, I have encountered a strange problem with some code I am writing to search the system process list for certain running processes. I am using subprocess.Popen() to call '/bin/ps -e'. When I save my code to the file pid.py (whose first line is #!/usr/bin/python) and run it with the command

Re: Cannot Remove File: Device or resource busy

2010-11-16 Thread MRAB
On 17/11/2010 01:37, Brett Bowman wrote: I'm spawning a subprocess to fix some formating errors with a library of PDFs with pdftk: try: sp = subprocess.Popen('pdftk.exe "%s" output %s' % (pdfFile, outputFile)) sp.wait() del sp except Exception, e: ret

Cannot Remove File: Device or resource busy

2010-11-16 Thread Brett Bowman
I'm spawning a subprocess to fix some formating errors with a library of PDFs with pdftk: try: sp = subprocess.Popen('pdftk.exe "%s" output %s' % (pdfFile, outputFile)) sp.wait() del sp except Exception, e: return "Unable to open file: %s with error: %s" % (p

Re: QT window closes immediately

2010-11-16 Thread News123
On 11/15/2010 02:04 AM, Martin Caum wrote: > I am attempting to open a window on mouse activity which works, but > the window fails to stay open. > I set it to terminate when the escape key is pressed even when the > program is not currently selected. This works fine. Originally I had > it create t

Re: QT window closes immediately

2010-11-16 Thread Diez B. Roggisch
Martin Caum writes: > I am attempting to open a window on mouse activity which works, but > the window fails to stay open. > I set it to terminate when the escape key is pressed even when the > program is not currently selected. This works fine. Originally I had > it create the window only with a

Re: argparse subparser problem

2010-11-16 Thread John O'Hagan
On Tue, 16 Nov 2010, Neal Becker wrote: > I want to have subparsers, but I also want to be able to say: > > myprogram --version > and get the version # > > --- [...] AFAIK, it is not possible ATM to have optional subparsers with argparse: http://code.google.com/p/argpar

Re: SQLite3 and lastrowid

2010-11-16 Thread fuglyducky
On Nov 16, 1:52 pm, Ian wrote: > On Nov 16, 2:08 pm, fuglyducky wrote: > > > db_connect = sqlite3.connect('test.db') > > cursor = db_connect.cursor() > > > print(cursor.lastrowid) > > At this point you haven't executed a query yet, so there is no > meaningful value that cursor.lastrowid can take.

Re: Is Unladen Swallow dead?

2010-11-16 Thread Dan Stromberg
I'm not a contributor to the U-S project, but I have been monitoring alternative python implementations' progress some, and seem to be adding something to pypy all of a sudden. I think unladen swallow has produced performance improvements, and they are likely to be merged into cpython 3.3. Howeve

Re: Some syntactic sugar proposals

2010-11-16 Thread John Ladasky
On Nov 14, 11:30 pm, alex23 wrote: > On Nov 15, 4:39 pm, Dmitry Groshev wrote: > > >     if x in range(a, b): #wrong! > > Only in Python 3.x, it's perfectly valid in Python 2.x. To achieve the > same in Python 3.x, try: > >     if x in list(range(a, b,)): # BUT SEE MY COMMENT BELOW > > > it feels

Is Unladen Swallow dead?

2010-11-16 Thread laspi
There has been little or no activity at all in this project in the last months, and the last comments on their mailing list seem to conrfim that it's future is uncertain. It's also very strange the lack of updates, news or discussions, specially considering that the merging plan has been approved.

Re: Raw Unicode docstring

2010-11-16 Thread Alexander Kapps
On 16.11.2010 22:56, Boštjan Mejak wrote: Hello, how does one write a raw unicode docstring? If I have backslashes in the docstring, I must tuck an 'r' in front of it, like this: r"""This is a raw docstring.""" If I have foreign letters in the docstring, I must tuck a 'u' in front of it, like t

Re: Raw Unicode docstring

2010-11-16 Thread Terry Reedy
On 11/16/2010 4:56 PM, Boštjan Mejak wrote: Hello, how does one write a raw unicode docstring? If I have backslashes in the docstring, I must tuck an 'r' in front of it, like this: r"""This is a raw docstring.""" You only need (and want that) if you want '\' to be taken literally. And even if

Re: Raw Unicode docstring

2010-11-16 Thread Robert Kern
On 11/16/10 3:56 PM, Boštjan Mejak wrote: Hello, how does one write a raw unicode docstring? If I have backslashes in the docstring, I must tuck an 'r' in front of it, like this: r"""This is a raw docstring.""" If I have foreign letters in the docstring, I must tuck a 'u' in front of it, like t

Re: Raw Unicode docstring

2010-11-16 Thread MRAB
On 16/11/2010 21:56, Boštjan Mejak wrote: Hello, how does one write a raw unicode docstring? If I have backslashes in the docstring, I must tuck an 'r' in front of it, like this: r"""This is a raw docstring.""" If I have foreign letters in the docstring, I must tuck a 'u' in front of it, like t

Re: Komodo 6, why "Workspace Restore" after every restart?

2010-11-16 Thread Aahz
[overquoting follows to prove my point] Someone who claims to care as much as you do about Usenet ought to have better quoting habits. You should be ashamed of yourself. In article <4ce0f788$0$30018$c3e8da3$76a7c...@news.astraweb.com>, John Doe wrote: >alex23 wrote: > >> John Doe wrote: > >

Re: Python OGL package

2010-11-16 Thread Xavier Ho
Also try Pyglet, in combination of PyOpenGL. Cheers, Xav On 17 November 2010 04:36, Marc-Andre Belzile < marc-andre.belz...@autodesk.com> wrote: > Hi list, > > > > could someone recommend a good python ogl package (open source is > preferred) ? I found these ones so far: > > > > http://pyopengl

Raw Unicode docstring

2010-11-16 Thread Boštjan Mejak
Hello, how does one write a raw unicode docstring? If I have backslashes in the docstring, I must tuck an 'r' in front of it, like this: r"""This is a raw docstring.""" If I have foreign letters in the docstring, I must tuck a 'u' in front of it, like this: u"""This is a Unicode docstring.""" Wh

Re: SQLite3 and lastrowid

2010-11-16 Thread Ian
On Nov 16, 2:08 pm, fuglyducky wrote: > db_connect = sqlite3.connect('test.db') > cursor = db_connect.cursor() > > print(cursor.lastrowid) At this point you haven't executed a query yet, so there is no meaningful value that cursor.lastrowid can take. > # Choose random index from DB - need to und

RE: What was your strategy?

2010-11-16 Thread Sells, Fred
It helps to try to solve a real (to you) problem, that way you discover what you don't know. If your code ends up nested 3 levels or your methods are more than 10 lines, ask for help. -Original Message- From: python-list-bounces+frsells=adventistcare@python.org [mailto:python-list-bou

Re: SQLite3 and lastrowid

2010-11-16 Thread Dan M
On Tue, 16 Nov 2010 13:08:15 -0800, fuglyducky wrote: > On Nov 16, 12:54 pm, Ian wrote: >> On Nov 16, 1:00 pm, fuglyducky wrote: >> >> > Before I added the second table I could simply run >> > 'print(cursor.lastrowid)' and it would give me the id number. >> > However, with two tables I am unable

Re: SQLite3 and lastrowid

2010-11-16 Thread fuglyducky
On Nov 16, 12:54 pm, Ian wrote: > On Nov 16, 1:00 pm, fuglyducky wrote: > > > Before I added the second table I could simply run > > 'print(cursor.lastrowid)' and it would give me the id number. However, > > with two tables I am unable to do this. > > It would help if you would show the code wher

Python OGL package

2010-11-16 Thread Marc-Andre Belzile
Hi list, could someone recommend a good python ogl package (open source is preferred) ? I found these ones so far: http://pyopengl.sourceforge.net/ http://wiki.wxpython.org/wxOGL thanks -mab -- http://mail.python.org/mailman/listinfo/python-list

Re: Help in language development

2010-11-16 Thread Felipe Bastos Nunes
[Portuguese talking, excuse me guys] Pedro, vocês podem dar um olhada no bug tracking, e estudar os códigos pra encontrar soluções. 2010/11/16 pedro igor sampaio avelino > Hello, my name Pedro Igor, I am a student and develop applications in > python for 1 year. I enrolled in the group to contri

How to implement a callback COM object in Python

2010-11-16 Thread Michael Bode
Hi, I'm trying to write a COM client to a COM server which controls a power meter. The COM server fires events that should be handled by the client. The docs state that I have to supply a class which implements the IFM2DeviceEvents interface. I need some instructions on how to translate the VB sam

Re: how to use socket to get packet which destination ip is not local?

2010-11-16 Thread MRAB
On 16/11/2010 20:38, Hans wrote: Hi, Maybe it's a very simple question. I'm trying to write a dhcpclient code with python. The dhcpclient does not have ip address at the very beginning, it sends out dhcpdiscover and then server sends back dhcpoffer. the dhcpoffer will use assigned ip as destinat

Re: SQLite3 and lastrowid

2010-11-16 Thread Ian
On Nov 16, 1:00 pm, fuglyducky wrote: > Before I added the second table I could simply run > 'print(cursor.lastrowid)' and it would give me the id number. However, > with two tables I am unable to do this. It would help if you would show the code where you're trying to do this. Without your actu

Help in language development

2010-11-16 Thread pedro igor sampaio avelino
Hello, my name Pedro Igor, I am a student and develop applications in python for 1 year. I enrolled in the group to contribute in developing this wonderful language that helps me both in day-to-day, but I'm going through some difficulties because they do not know where to start, can someone please

how to use socket to get packet which destination ip is not local?

2010-11-16 Thread Hans
Hi, Maybe it's a very simple question. I'm trying to write a dhcpclient code with python. The dhcpclient does not have ip address at the very beginning, it sends out dhcpdiscover and then server sends back dhcpoffer. the dhcpoffer will use assigned ip as destination ip, but that ip is not client's

first attempts with pybluez on Win XP fail

2010-11-16 Thread Gelonida
Hi, My post from Google groups doesn't sem to get through. SO here once more posted from gmane. Wanted to write a first simple example with pybluez and offer a serial connection service with a given name. What I tried (being inspired by http://people.csail.mit.edu/albert/bluez-intro/x290.html )

SQLite3 and lastrowid

2010-11-16 Thread fuglyducky
I am fairly new to Python (no development experience) and brand new to using sqlite through Python. With that said, I created a database with two tables. The first has about 30,000 rows of static data. The second has 9 rows of static data. Before I added the second table I could simply run 'print(

Re: What was your strategy?

2010-11-16 Thread Steve Holden
On 11/16/2010 2:22 PM, Lou Pecora wrote: > I'll jump in and recommend the book "Python in a Nutshell" by Martelli. > It may be a little dated now, but it covers many Python topics in good > detail without becoming a bloated reference. Nicely written. It's still > the first book I reach for aft

argparse subparser problem

2010-11-16 Thread Neal Becker
I want to have subparsers, but I also want to be able to say: myprogram --version and get the version # --- import argparse def stop(): pass parser = argparse.ArgumentParser() parser.add_argument ('--version', action='store_true') subparsers = parser.add_subparsers

Re: What was your strategy?

2010-11-16 Thread Lou Pecora
In article , Dennis Lee Bieber wrote: > On Sun, 14 Nov 2010 16:32:24 -0600, Jorge Biquez > declaimed the following in gmane.comp.python.general: > > > I was wondering if you can share what was the strategy you followed > > to master Python (Yes I know I have to work hard study and practice a

Re: Help: Guide needed in trying to delete/flush the content of a fifo file.

2010-11-16 Thread MRAB
On 16/11/2010 06:52, Ton wrote: On Nov 16, 1:47 am, MRAB wrote: On 15/11/2010 11:03, Ton wrote: On Nov 14, 11:55 pm, MRABwrote: On 14/11/2010 14:48, ton ph wrote:>Hi python geeks, I have problem which i have been trying to find out for the past some days, i have a device whi

Re: [RELEASED] Python 3.2 alpha 3

2010-11-16 Thread Raymond Hettinger
On Nov 16, 9:23 am, Mark Summerfield wrote: > I think it might be worth mentioning in What's New: FWIW, I'll be updating the What's New document for the Beta. Raymond -- http://mail.python.org/mailman/listinfo/python-list

Re: Some syntactic sugar proposals

2010-11-16 Thread André
On Nov 15, 2:39 am, Dmitry Groshev wrote: > Here are some proposals. They are quite useful at my opinion and I'm > interested for suggestions. It's all about some common patterns. > First of all: how many times do you write something like >     t = foo() >     t = t if pred(t) else default_value

Re: [Python-Dev] [RELEASED] Python 3.2 alpha 3

2010-11-16 Thread Mark Summerfield
Hi Georg, On Tue, 12 Oct 2010 14:40:52 +0200 Georg Brandl wrote: > -BEGIN PGP SIGNED MESSAGE- > Hash: SHA1 > > On behalf of the Python development team, I'm happy to announce the > third and final alpha preview release of Python 3.2. [snip] I built & ran Py3.2a4's tests & they were fine

Pickle in a POST/GET request give EOFError

2010-11-16 Thread Romaric DEFAUX
Hi everybody ! First time I write to this mailing list :) I started writing in python last week, that's probably why I can't understand the following problem... I create a list called web_site_list. This list contain dictionaries called web_site. And some values in this dictionaries are list

first attempt with pybluez on XP fail

2010-11-16 Thread gelonida
Hi, Wanted to write a first simple example with pybluez and offer a serial connection service with a given name. What I tried (being inspired by http://people.csail.mit.edu/albert/bluez-intro/x290.html ) is: server_sock=bluetooth.BluetoothSocket( bluetooth.RFCOMM ) port = bluetooth.PORT_ANY # o

Re: Some syntactic sugar proposals

2010-11-16 Thread Ian Kelly
On 11/16/2010 3:42 AM, Steven D'Aprano wrote: On Mon, 15 Nov 2010 22:40:00 -0700, Ian Kelly wrote: On 11/15/2010 10:26 PM, Steven D'Aprano wrote: t = foo()+bar()+baz() if pred(it) else baz()-foo()-bar() What does "it" mean here? "it" would mean the result of the expression foo()+bar()+baz()

[RELEASED] Python 3.2 alpha 4

2010-11-16 Thread Georg Brandl
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On behalf of the Python development team, I'm happy to announce the fourth and (this time really) final alpha preview release of Python 3.2. Python 3.2 is a continuation of the efforts to improve and stabilize the Python 3.x line. Since the final rel

Re: Getting references to objects without incrementing reference counters

2010-11-16 Thread Artur Siekielski
On Nov 15, 10:06 pm, John Nagle wrote: > On 11/14/2010 11:08 AM, Artur Siekielski wrote: > > > Hi. > > I'm using CPython 2.7 and Linux. In order to make parallel > > computations on a large list of objects I want to use multiple > > processes (by using multiprocessing module). In the first step I

Re: Some syntactic sugar proposals

2010-11-16 Thread Steven D'Aprano
On Mon, 15 Nov 2010 22:40:00 -0700, Ian Kelly wrote: > On 11/15/2010 10:26 PM, Steven D'Aprano wrote: >> t = foo()+bar()+baz() if pred(it) else baz()-foo()-bar() >> >> What does "it" mean here? > > "it" would mean the result of the expression foo()+bar()+baz(). What > else could it mean? It cou

Re: strange behavor....

2010-11-16 Thread Hrvoje Niksic
m...@distorted.org.uk (Mark Wooding) writes: >> So even if the globals() dictionary is custom, its __setitem__ method is >> *not* called. > > Fascinating. Thank you. In case it's not obvious, that is because CPython assumes the type for many of its internal or semi-internal structures, and calls