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
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
}
> 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.
> >
&
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
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?
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
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
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
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
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
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
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
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
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
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):
&
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
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
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
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... :(
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
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
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
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
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
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
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
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
> 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
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
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! :)
> >
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 {
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
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
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:
>
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
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
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
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
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
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
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
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
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
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
44 matches
Mail list logo