Re: segmentation fault while using ctypes

2009-04-14 Thread Aaron Brady
On Apr 14, 6:45 pm, Aaron Brady wrote: > On Apr 14, 6:04 pm, sanket wrote: > > > > > On Apr 14, 4:00 pm, MRAB wrote: > > > > sanket wrote: > > > > Hello All, > > > > > I am dealing with this weird bug. > > > > I have a function in C and I have written python bindings for it using > > > > ctypes.

Re: Automatically generating arithmetic operations for a subclass

2009-04-14 Thread norseman
Steven D'Aprano wrote: I have a subclass of int where I want all the standard arithmetic operators to return my subclass, but with no other differences: class MyInt(int): def __add__(self, other): return self.__class__(super(MyInt, self).__add__(other)) # and so on for __mul__,

Re: [Python-Dev] PEP 382: Namespace Packages

2009-04-14 Thread P.J. Eby
At 10:59 PM 4/14/2009 +0200, M.-A. Lemburg wrote: You are missing the point: When breaking up a large package that lives in site-packages into smaller distribution bundles, you don't need namespace packages at all, so the PEP doesn't apply. The way this works is by having a base distribution bun

Re: any(), all() and empty iterable

2009-04-14 Thread John O'Hagan
On Tue, 14 Apr 2009, Mark Dickinson wrote: > On Apr 14, 7:21 pm, Luis Alberto Zarrabeitia Gomez > > wrote: > > It's more than that. Python's following the rules here. Maybe it could be > > documented better, for those without a background in logic/discrete > > mathematics, but not changed. > > Agr

iPython help, Docstring [source file open failed]

2009-04-14 Thread R. David Murray
Kegan wrote: > I use iPython installed from macport. When I am in the iPython shell, > I do the following: > > > In [8]: from datetime import timedelta > > In [9]: timedelta?? > Type: type > Base Class: > String Form: > Namespace: Interactive > File: /opt/local

Interrupt Python C API

2009-04-14 Thread googler . 1 . webmaster
Hi, I just have a design problem and don't know how to solve it. I call a function which executes a simple "PyRun_String(...)" command. imagine the script while 1: pass is executed so the app would hang. Is there any chance to break out this PyRun_String-function? I just searched the forums for t

Help with run command + variable.

2009-04-14 Thread R. David Murray
Daniel Holm wrote: > Hi everybody, > > I'm creating my first app (SixA @ http://www.launchpad/gsixaxis) and I have > gtk.combobox to chose a profile. When a profile is chosen I save the > profiles name as a variable, and now I want to combine a command with the > variable. > > Lets say that the

Re: any(), all() and empty iterable

2009-04-14 Thread Piet van Oostrum
> Mark Dickinson (MD) wrote: >MD> On Apr 14, 7:21 pm, Luis Alberto Zarrabeitia Gomez >MD> wrote: >>> It's more than that. Python's following the rules here. Maybe it could be >>> documented better, for those without a background in logic/discrete >>> mathematics, >>> but not changed. >MD>

Re: Using Python after a few years of Ruby

2009-04-14 Thread blahemailblah
Thanks for the help everyone. I'll take some time to go through these and how they all work. I appreciate the feedback. :) Dave -- http://mail.python.org/mailman/listinfo/python-list

Re: iPython help, Docstring [source file open failed]

2009-04-14 Thread alex23
On Apr 15, 5:35 am, Przemyslaw Kaminski wrote: > You may want to try: > import pydoc > b = pydoc.render_doc(timedelta) > print b Isn't this exactly the same output you get from typing 'help (timedelta)' though? -- http://mail.python.org/mailman/listinfo/python-list

Re: Modifying the value of a float-like object

2009-04-14 Thread Steven D'Aprano
On Tue, 14 Apr 2009 14:45:47 -0400, Dave Angel wrote: > The answer to your original question is no. If the value can be > changed, then it doesn't behave like a float. And that's not just a > pedantic answer, it's a serious consideration. Oh nonsense. Many programming languages have mutable flo

Re: any(), all() and empty iterable

2009-04-14 Thread Steven D'Aprano
On Tue, 14 Apr 2009 17:54:14 +, John O'Hagan wrote: > Agreed; having absorbed the answers to my original question, I now > understand why all('Robinson Crusoe' in books for books in []) - or with > any object in place of the string, or indeed just all([]) - doesn't > return False, but, vacuous

Re: any(), all() and empty iterable

2009-04-14 Thread Steven D'Aprano
On Tue, 14 Apr 2009 14:27:59 +0100, Arnaud Delobelle wrote: > In fact the doc is not just misleading, but plain wrong as the following > shows: > def alwaystrue(): > ... while True: yield True > ... all(alwaystrue()) > [Python is stuck] > > The iterable alwaystrue() satisfies the p

Re: sharing/swapping items between lists

2009-04-14 Thread Aaron Brady
On Apr 14, 7:01 pm, Aaron Brady wrote: > On Apr 14, 12:37 pm, Ross wrote: > > > > > On Apr 14, 10:34 am, Ross wrote: > > > > On Apr 14, 5:57 am, a...@pythoncraft.com (Aahz) wrote: > > > > > In article > > > > , > > > > > Ross   wrote: > > > > >On Apr 13, 9:08=A0am, a...@pythoncraft.com (Aahz) w

Re: any(), all() and empty iterable

2009-04-14 Thread Aaron Brady
On Apr 14, 7:32 pm, John O'Hagan wrote: > On Tue, 14 Apr 2009, Mark Dickinson wrote: > > On Apr 14, 7:21 pm, Luis Alberto Zarrabeitia Gomez > > > wrote: > > > It's more than that. Python's following the rules here. Maybe it could be > > > documented better, for those without a background in logic

Re: Python and XML Help

2009-04-14 Thread ookrin
On Apr 12, 12:51 am, "Diez B. Roggisch" wrote: > ookrin schrieb: > > > > > I'm in the process of learning python and PyQt4. I had decided to make > > myself a simple app and soon discovered that I needed to crash into > > xml to use some of the data I was going to be getting off of the > > server.

Re: sharing/swapping items between lists

2009-04-14 Thread Ross
On Apr 14, 7:18 pm, Aaron Brady wrote: > On Apr 14, 7:01 pm, Aaron Brady wrote: > > > > > On Apr 14, 12:37 pm, Ross wrote: > > > > On Apr 14, 10:34 am, Ross wrote: > > > > > On Apr 14, 5:57 am, a...@pythoncraft.com (Aahz) wrote: > > > > > > In article > > > > > , > > > > > > Ross   wrote: > >

Re: zProblem

2009-04-14 Thread Steven D'Aprano
On Tue, 14 Apr 2009 14:42:32 -0700, norseman wrote: > Grids are uniform! Same size, non-changing across whole backdrop. There > is nothing in uniform that says X==Y. Units along axis need not be same. > Corners don't even have to be 90degrees. (Spherical) But they must > measure as same size cel

Re: path to executing .py file

2009-04-14 Thread tiefeng wu
> > > The path of your script is given by __file__. thanks MRAB, and sorry for such a trivial question :) cheers! tiefeng wu -- http://mail.python.org/mailman/listinfo/python-list

Re: Python and XML Help

2009-04-14 Thread John Machin
On Apr 15, 12:29 pm, ookrin wrote: > On Apr 12, 12:51 am, "Diez B. Roggisch" wrote: > > > > > ookrin schrieb: > > > > I'm in the process of learning python and PyQt4. I had decided to make > > > myself a simple app and soon discovered that I needed to crash into > > > xml to use some of the data

Re: Modifying the value of a float-like object

2009-04-14 Thread Steven D'Aprano
On Tue, 14 Apr 2009 06:03:58 -0700, Eric.Le.Bigot wrote: > Hello, > > Is there a way to easily build an object that behaves exactly like a > float, but whose value can be changed? Yes, have a look at the source code for UserString.MutableString for some ideas. > The goal is to maintain a list

Beginner: Portable Python, BeautifulSoup & ScrapeNFeed

2009-04-14 Thread Joe Larson
Hello list! I am a Python Beginner. I thought a good beginning project would be to use the Portable Python environment http://www.portablepython.com/ with Beautiful Soup http://www.crummy.com/software/BeautifulSoup/ and Scrape 'N' Feed http://www.crummy.com/software/ScrapeNFeed/ to create and

Re: segmentation fault while using ctypes

2009-04-14 Thread bieffe62
On Apr 15, 12:39 am, sanket wrote: > Hello All, > > I am dealing with this weird bug. > I have a function in C and I have written python bindings for it using > ctypes. > > I can call this function for couple of times and then suddenly it > gives me seg fault. > But I can call same function from a

Re: Modifying the value of a float-like object

2009-04-14 Thread Ben Finney
Steven D'Aprano writes: > On Tue, 14 Apr 2009 06:03:58 -0700, Eric.Le.Bigot wrote: > > The goal is to maintain a list [x, y,…] of these float-like > > objects, and to modify their value on the fly (with something like > > x.value = 3.14) so that any expression like "x > > +y" uses the new value.

Re: Python and XML Help

2009-04-14 Thread ookrin
On Apr 14, 8:15 pm, John Machin wrote: > On Apr 15, 12:29 pm, ookrin wrote: > > > > > On Apr 12, 12:51 am, "Diez B. Roggisch" wrote: > > > > ookrin schrieb: > > > > > I'm in the process of learning python and PyQt4. I had decided to make > > > > myself a simple app and soon discovered that I nee

How to query object of GUI?

2009-04-14 Thread Muddy Coder
Hi Folks, I need to query the ID of GUI, in Tkinter, but don't know how to do it. This is my code: calss MyGUI: def make_menu(self): top = Menu(self) menObj = Menu(top) labels = read_from_database() for lab in labels: menObj.add_command(label=lab, c

Re: Modifying the value of a float-like object

2009-04-14 Thread Steven D'Aprano
On Tue, 14 Apr 2009 12:36:02 -0700, Eric.Le.Bigot wrote: > I'll give more details, as David S. and David R. were asking for. The > code could look like this: > > import crystals > my_crystal = crystals.Crystal("Quartz 111") > > which would set some attributes of my_crystal as "floats with >

Re: GUI Programming

2009-04-14 Thread laplacia...@gmail.com
On Apr 12, 12:04 pm, Gabriel wrote: > r wrote: > > On Apr 12, 8:07 am, Gabriel wrote: > > >> Hello, > > >> I'm python newbie and i need to write gui for my school work in python. > >> I need to write it really quick, > > > [snip] > > > Tkinter is built-in, why not start there? > > > from Tkinter

Re: How to query object of GUI?

2009-04-14 Thread John McMonagle
Muddy Coder wrote: > Hi Folks, > > I need to query the ID of GUI, in Tkinter, but don't know how to do > it. This is my code: > > calss MyGUI: > >def make_menu(self): > top = Menu(self) > menObj = Menu(top) > labels = read_from_database() > for lab in label

Re: Using Python after a few years of Ruby

2009-04-14 Thread laplacia...@gmail.com
On Apr 14, 3:01 am, blahemailb...@gmail.com wrote: > > 1) Rake - is there an equivalent of Rake? I've seen a bit about SCons, > and it looks really nice, but it seems geared towards being a Make > replacement for C/C++ rather than something that's used to work with > Python itself. Is there anythin

Re: binary file compare...

2009-04-14 Thread Martin
Hi, On Mon, Apr 13, 2009 at 10:03 PM, Grant Edwards wrote: > On 2009-04-13, SpreadTooThin wrote: > >> I want to compare two binary files and see if they are the same. >> I see the filecmp.cmp function but I don't get a warm fuzzy feeling >> that it is doing a byte by byte comparison of two files

Re: Python and XML Help

2009-04-14 Thread John Machin
On Apr 15, 2:25 pm, ookrin wrote: > > > Seeing the errors - I changed the two classes to this: > > class offlineLoad(): >     def loadXmlFile(self): >         print "Loading from File" >         xf = open('CharacterID.xml','r') >         xml = xmlHandler() >         saxparser = make_parser() >    

Re: Using Python after a few years of Ruby

2009-04-14 Thread Martin
Hi, On Tue, Apr 14, 2009 at 9:01 AM, wrote: > 2) Gems - I've seen a bit about Eggs, but they don't seem to have > anywhere near the official status gems do for Ruby. Are there any > "package management" things like this for Python, or do you usually > just grab the code you need as-is? On a sid

reading arguments in python script when passed from URL

2009-04-14 Thread phaneendra s
hi alll.. iam invoking a python script from a standalone client which looks lik this String command="ln -s /usr/lib /tmp/lin"; //creating a soft link URL url = new URL("http://server-name/cgi-bin/finalexec1.py?command= "+command); but iam not able to read this command in the python script

Re: zProblem

2009-04-14 Thread Gabriel Genellina
En Tue, 14 Apr 2009 18:42:32 -0300, norseman escribió: Gabriel Genellina wrote: En Mon, 13 Apr 2009 15:13:53 -0300, norseman escribió: Gabriel Genellina wrote: Below there is an attempt to reproduce the layout you describe in the PDF: from Tkinter import * root = Tk() pane = Fram

Re: ctypes - random access to address space

2009-04-14 Thread Tim Roberts
janislaw wrote: > >I am currently doing a project in which I interface to a PCI card. To >ease the prototyping, I call the API functions, which map the address >space of the card to a process memory. As a driver developer, I am obligated by the Driver Curmudgeon's Code of Ethics to point out that

Re: Interrupt Python C API

2009-04-14 Thread Tim Roberts
googler.1.webmas...@spamgourmet.com wrote: > >I just have a design problem and don't know how to solve it. I call a >function which >executes a simple "PyRun_String(...)" command. > >imagine the script while 1: pass is executed so the app would hang. Is >there any chance to break out this PyRun_Str

running pkg_resources from a compiled py2exe prog ram

2009-04-14 Thread David Lyon
Hi, I'm trying to make an exe that uses pkg_resources. Every time I try to run the compiled version it always fails complaining that it is missing pkg_resources. Traceback (most recent call last): File "PythonPackageManager.py", line 6, in import MainWindow File "MainWindow.pyc", line

running pkg_resources from a compiled py2exe prog ram

2009-04-14 Thread David Lyon
btw the code is just.. import ConfigParser import zipfile import os import subprocess import getopt, sys import os.path import _winreg import pkg_resources -- http://mail.python.org/mailman/listinfo/python-list

<    1   2