Re: Properly Using 3.4.1 & Valgrind

2014-09-17 Thread Jeremy Moles
On Wednesday, September 17, 2014 6:46:21 PM UTC-4, Jeremy Moles wrote: > Hey guys. I'm using the Python 3.4.1 release tarball, and am trying to > configure it for usage with valgrind. I have followed all of the common, > well-documented steps online such as uncommenting Py_USING_M

Properly Using 3.4.1 & Valgrind

2014-09-17 Thread Jeremy Moles
Hey guys. I'm using the Python 3.4.1 release tarball, and am trying to configure it for usage with valgrind. I have followed all of the common, well-documented steps online such as uncommenting Py_USING_MEMORY_DEBUGGER, compiling with --with-pydebug, --with-valgrind, and --without-pymalloc. I've

Wrapping A Shell

2006-11-28 Thread Jeremy Moles
I'm not sure if this is really the right place to ask this question, but since the implementation is in Python, I figured I'd give it a shot. I want to "wrap" a shell process using popen inside of python program rather than creating a new shell process for each line I process in the app. For examp

[ANNOUNCE] PyIW and PyWPA

2006-03-03 Thread Jeremy Moles
Sorry for the double-post; that's what I get for using busted, Dapper Evolution. :) Many updates to the modules I'm writing for interacting with wireless networking in Linux using Python. PyIW - Python bindings to libiw. PyWPA - P

[ANNOUNCE] PyIW and PyWPA

2006-03-03 Thread Jeremy Moles
Many updates to the modules I'm writing for interacting with wireless networking in Linux using Python. PyIW - Python bindings to libiw. PyWPA - Python bindings/wrapper for wpa_supplicant. They can be found here: http://downloads.emperorlinux.com/contrib/pyiw http://downloads.emperorlinux.com/c

Linux NETLINK Sockets

2006-01-11 Thread Jeremy Moles
http://mail.python.org/pipermail/python-dev/2005-January/050834.html ^^ From a year ago or so--did this never get put into Python trunk? As far as I can tell the answer is no. It's something I'd like to use in Python if available, though, writing a small wrapper wouldn't be out of the question if

PyConn--anyone needing roommates?

2006-01-11 Thread Jeremy Moles
There's a specific list, I believe, for this sort of question, but it has been surprisingly quiet since I registered. :) My employer has agreed to send me to PyConn this year (yay!) but I'm on my own as far as roomage is concerned. If anyone needs another body--or wants to find another body--I'm g

Most SHAMEFUL one-liner:

2005-12-04 Thread Jeremy Moles
I was looking through some code of my today and noticed this little gem I wrote a few days back that I had totally forgot about: fill = [("%%-%ds\n" % (columns - 1)) % " " for i in range(yoffset - 2)] ...and then I went on to do: "".join(fill) Talk about using the wrong tool for the job... :(

Re: ncurses' Dark Devilry

2005-11-29 Thread Jeremy Moles
On Tue, 2005-11-29 at 20:50 +, Tony Nelson wrote: > In article <[EMAIL PROTECTED]>, > Jeremy Moles <[EMAIL PROTECTED]> wrote: > > > I'm working on a project using ncurses w/ Python. As an aside, I > > implemented addchstr in the cursesmodule.c file in

ncurses' Dark Devilry

2005-11-29 Thread Jeremy Moles
I'm working on a project using ncurses w/ Python. As an aside, I implemented addchstr in the cursesmodule.c file in Python SVN, if anyone wants me to try and get that made permanent. AT ANY RATE... I was wondering--and this is more a general curses question rather than a Python one, but I know th

Re: Floating numbers and str

2005-11-09 Thread Jeremy Moles
I think you answered your own question. :) x = 0.12345678 y = "%.4f something here" % x On Wed, 2005-11-09 at 11:52 -0800, Tuvas wrote: > I would like to limit a floating variable to 4 signifigant digits, when > running thorugh a str command. Ei, > > > x=.13241414515 > y=str(x)+" something here

Re: Why doesn't this work? :)

2005-10-28 Thread Jeremy Moles
am using. :) What I'm wondering is if the other method could work, of if it simply impossible in Python considering it's underlying implementation. > On Fri, Oct 28, 2005 at 02:02:29PM -0400, Jeremy Moles wrote: > > Jumping right into the code (which should speak for itself): &

Why doesn't this work? :)

2005-10-28 Thread Jeremy Moles
Jumping right into the code (which should speak for itself): # --- try: # this will fail and be caught # below, w import foobar except ImportError, error: class foobar: @staticmethod def __getattr

Re: How to get a raised exception from other thread

2005-10-14 Thread Jeremy Moles
On non-Windows system there are a ton of ways to do it--this is almost a whole field unto itself. :) (D-BUS, fifos, sockets, shmfs, etc.) In Windows, I wouldn't have a clue. I guess this is a hard question to answer without a bit more information. :) On Fri, 2005-10-14 at 14:45 -0700, dcrespo wr

Re: Pass a tuple (or list) to a C wrapper function

2005-10-12 Thread Jeremy Moles
It depends on how you want to manipulate the data in C. If you want compile-time variable access to each float, yeah, 50 floats. :) Probably what you want to do though is just keep the tuple as is and iterate over it using the PySequence_* protocol: http://docs.python.org/api/sequence.html On W

Re: PyObject_New

2005-10-07 Thread Jeremy Moles
n v. Löwis" wrote: > Jeremy Moles wrote: > > PyObject* obj = _PyObject_New(&PyType_MyType); > > obj = PyObject_Init(obj, &PyType_MyType); > > > > ... > > > > return obj; > > The call to PyObject_Init is redundant: _PyOb

C/API Clarification

2005-10-07 Thread Jeremy Moles
First of all, let me say I really do appreciate--and frequently use--the ample and easy to read Python documentation. However, there are a few things I'm still unclear on, even after asking multiple questions here on the list (thanks everyone!) and reading the "Extending" and "Reference" docs from

PyObject_New

2005-10-06 Thread Jeremy Moles
Hey guys, sorry to ask another question of this nature, but I can't find the answer or a single example of it anywhere. I'm sure it's been asked before, but my google-fu isn't strong enough to find anything. I have the following: struct MyType { PyObject_HEAD

Re: Absolultely confused...

2005-10-06 Thread Jeremy Moles
WELL, I figured it out--thanks to everyone's help. There were instances of the object and I am a total moron. Thanks again to everyone who helped me stomp this out. :) On Wed, 2005-10-05 at 21:58 -0400, Jeremy Moles wrote: > So, here is my relevant code: > > PyArg_Parse

Re: Absolultely confused...

2005-10-06 Thread Jeremy Moles
tmar wrote: > Jeremy Moles wrote: > > So, here is my relevant code: > > > > PyArg_ParseTuple(args, "O!", &PyType_vector3d, &arg1) > > > > And here ismy error message: > > > > argument 1 must be pylf.core.vector3d, not pylf.core.v

Re: Absolultely confused...

2005-10-06 Thread Jeremy Moles
re declared and assigned to all at once, only once. Am I misunderstanding the point? :) /me ducks On Thu, 2005-10-06 at 16:26 +0200, Thomas Heller wrote: > Jeremy Moles <[EMAIL PROTECTED]> writes: > > > So, here is my relevant code: > > > > PyArg_ParseTuple(arg

Re: Absolultely confused...

2005-10-06 Thread Jeremy Moles
All of these are runtime errors. Using GCC4 and compiling perfectly with -Wall. On Thu, 2005-10-06 at 09:12 -0500, Brandon K wrote: > > If I take out the "!" in the format string and just use "O", I can at > > least get past PyArg_ParseTuple. > > Is this a compile-time error? Or a runtime error?

Absolultely confused...

2005-10-06 Thread Jeremy Moles
So, here is my relevant code: PyArg_ParseTuple(args, "O!", &PyType_vector3d, &arg1) And here ismy error message: argument 1 must be pylf.core.vector3d, not pylf.core.vector3d I know PyType_vector3d "works" (as I can use them in the interpreter all day long), and I know I'm passi

Re: return own type from Python extention?

2005-09-29 Thread Jeremy Moles
} > return (PyObject *)self; > } > > ..but how do I have to call this from C-Code or how will another > Funktion for this look like? > > > > Jeremy Moles wrote: > > You can use Py_BuildValue for most what you're probably going to need. > > &

Re: return own type from Python extention?

2005-09-29 Thread Jeremy Moles
n: > > static PyObject* PyMyType_new(PyTypeObject *type, PyObject *args, > PyObject *kwds) > { > PyMyType *self; > self = (PyMyType*)type->tp_alloc(type, 0); > if (self != NULL) { > self->test = 0; > } > return (PyObject *)self; &g

Strange Extension Module Behavior

2005-09-28 Thread Jeremy Moles
Hey guys. I have an extension module written in C that abstracts and simplifies a lot of what we do here. I'm observing some strange behavior and wanted to know if anyone had any advice as to how I should start tracking this down. More specific suggestions are obviously appreciated, but I really do

Re: Implementing class methods in C

2005-08-18 Thread Jeremy Moles
I honestly don't know the answer to this and I am entirely guessing but--does it work without using the new module? That is: import _test class Foo: pass foo = Foo() foo.bar = _test.func2 foo.bar() On Thu, 2005-08-18 at

Re: Invoking GUI for app running in background with a keypress

2005-08-15 Thread Jeremy Moles
If you want to get crazy you can poll() on one of the evdev nodes (/dev/input/event*) and behave accordingly. I do this in a C application we use to do the exact same thing you're talking about. Each successful read from the device returns a 16-byte input_event struct (or similar, I'm going from

Py_DECREF Question:

2005-08-15 Thread Jeremy Moles
When I add an object created locally to a mapping or sequence (that will be returned from a function into an running instance of the Python interpreter), I need to call Py_DECREF on the object, right? Unfortunately, I really feel like the following code leaks memory... --- for example --- PyObjec

Re: Printing literal text of an argument

2005-08-11 Thread Jeremy Moles
def debug(s): print "s" exec(s) The line thing i'm not so sure about. Er. Hmmm. On Thu, 2005-08-11 at 14:04 -0700, Rex Eastbourne wrote: > Hi all, > > I've written the following simple macro called debug(aname, avalue) > that prints out the name of an expression and its value: >

Python Wireless Extension Module (pyiw)

2005-08-11 Thread Jeremy Moles
I am mostly done with writing an extension module in C that wraps (and makes easier) interfacing with libiw (the library that powers iwconfig, iwlist, and friends on Linux). We're using this internally for a tool to manage wireless connectivity. This is a million times better than hundreds of invoc

Re: Adding and attribute to an instance

2005-08-09 Thread Jeremy Moles
Hmmm--I would also be interested in knowing the answer to this. I get the exact same behavior as the OP (probably because it's the intended behavior?) On Tue, 2005-08-09 at 14:38 -0700, J wrote: > Hi, > > > I am trying to add new data attributes to my extension classes from > within a script. I

Module Extension C/CPI Question

2005-08-09 Thread Jeremy Moles
Just a quick question before I waste time doing something that will immediately be disregarded as unacceptable code... :) When using the C API and writing extension modules, how do you normally pass a structure up into the python module? For instance, if I have a structure: typedef struct Foo {

Re: Wheel-reinvention with Python (was: Ten Essential Development Practices)

2005-07-29 Thread Jeremy Moles
On Fri, 2005-07-29 at 14:19 -0300, Jorge Godoy wrote: > Jeremy Moles wrote: > > > Four? > > > > 1. wx > > 2. PyGTK > > 3. Tk (Are you including this one even?) > > 4. ??? > > PyQt / PyKDE. Ah! Can't believe I forgot that one! :) > >

Re: Wheel-reinvention with Python (was: Ten Essential Development Practices)

2005-07-29 Thread Jeremy Moles
On Fri, 2005-07-29 at 17:59 +0200, Torsten Bronger wrote: > Hallöchen! > > Michael Hoffman <[EMAIL PROTECTED]> writes: > > > Dark Cowherd wrote: > > > >> GUI, Web development, Application Framework - it is shambles. > > > > Yeah, I agree. When I finally make that GUI application I still > > don't

Re: Ten Essential Development Practices

2005-07-28 Thread Jeremy Moles
> He spends so much space on "Create Consistent Command-Line Interfaces," > a section that, in Python, could be replaced with a simple "Use optparse." Haha... I don't know why but that really made me laugh. :) Might even use it as a sig or something... :) > -- > Michael Hoffman -- http://ma

Re: Trigger pygtk drawingarea redraw

2005-07-28 Thread Jeremy Moles
Call the gtk.Widget method queue_draw(); if you derive from DrawingArea then simply: self.queue_draw() Of if the DrawingArea is some kind of "has-a" member: self.DrawableThing.queue_draw() On Thu, 2005-07-28 at 02:52 -0700, ch424 wrote: > Hi, > > Does anybody know the fastest way to trigger a

Re: [OT] Problems with permissions etc

2005-07-27 Thread Jeremy Moles
On Wed, 2005-07-27 at 00:36 -0700, Frank Millman wrote: > Hi all > > This is not strictly a Python question, but this newsgroup feels like a > family to me, so I hope that someone will be kind enough to respond to > this, or at least point me in the right direction. > > While developing under lin

Bash Helper Script

2005-07-27 Thread Jeremy Moles
I wrote something real quick this morning that I thought might be somewhat useful to someone else. It's just a bash script that lets you do a few things do a "project directory" (in my case, python subversion projects) in a decently sensible way. Usage is: # cp pypadmin MyProjectDir/pypadmin # ./p

Re: multiple inheritance super()

2005-07-26 Thread Jeremy Moles
Ignore my last response; just read it fully and realized how dumb my response was. :) On Wed, 2005-07-27 at 12:44 +0530, km wrote: > Hi all, > > In the following code why am i not able to access class A's object attribute > - 'a' ? I wishto extent class D with all the attributes of its base cla

Re: multiple inheritance super()

2005-07-26 Thread Jeremy Moles
Thought I'm not sure (and don't have time to test) I'd guess it's because you haven't explicitly called the __init__ method chain. i.e., B calls A, C calls B, etc. This is probably where the actual data gets pulled into scope. On Wed, 2005-07-27 at 12:44 +0530, km wrote: > Hi all, > > In the fo

Re: Help with mass remove in text file

2005-07-13 Thread Jeremy Moles
On Wed, 2005-07-13 at 09:00 -0700, [EMAIL PROTECTED] wrote: > I'm trying to open a text file, remove all instances of the words > "f=x;" and "i=x;" where x can be any number 0-14. Also, I want to > remove all { " or ) or ( or ' } each time one of those characters > occurs respectively. This

Polling, Fifos, and Linux

2005-07-07 Thread Jeremy Moles
This is my first time working with some of the more lower-level python "stuff." I was wondering if someone could tell me what I'm doing wrong with my simple test here? Basically, what I need is an easy way for application in userspace to simply echo values "down" to this fifo similar to the way pr

Inheritance/Late Private Binding

2005-07-06 Thread Jeremy Moles
class BaseClass: def __init__(self): self.__data = None def getMember(self): return self.__data class GoodSubClass(BaseClass): def __init__(self): BaseClass.__init__(self) class BadSubClass(BaseClass): def __init__(s