Re: ctypes from_param() truncating 64 bit pointers to 32 bit

2011-02-18 Thread Joakim Hove
On 18 Feb, 10:55, Stefan Krah wrote: > Joakim Hove wrote: > > > and I actually don't know how this specific case works. > > > However, you are not providing a function signature for the "print_addr" C > > > function in the BugTest case, so my guess is

Re: ctypes from_param() truncating 64 bit pointers to 32 bit

2011-02-18 Thread Joakim Hove
> Ok, then take care to post proper code next time. Details can be important, > especially when asking about non-obvious problems. Point taken - however the original context where the problem arose consists of several massive libraries, which would be quite impractical to post on a forum. The code

Re: ctypes from_param() truncating 64 bit pointers to 32 bit

2011-02-18 Thread Joakim Hove
Thanks for answering; > I rarely use ctypes You should :-) Apart from my current struggle I think ctypes is really good. > and I actually don't know how this specific case works. > However, you are not providing a function signature for the "print_addr" C > function in the BugTest case, so my gu

ctypes from_param() truncating 64 bit pointers to 32 bit

2011-02-18 Thread Joakim Hove
Hello, I wonder if I am encountering a bug in ctypes; or if I am doing things wrong? I have written a small Python class wrapping a C library, the Python class has a from_param() method which passes a "raw pointer value" from Python to C. When reaching C the pointer has been truncated to 32 bits.

Re: ctypes and garbage collection

2010-09-06 Thread Joakim Hove
> I'd add an "__owner" field to the node, initialised with the owning > container instance. I will - thank you! Joakim -- http://mail.python.org/mailman/listinfo/python-list

ctypes and garbage collection

2010-09-06 Thread Joakim Hove
enough to protect the Container instance from beeing garbage collected? I thought maybe the get_node() function should have something like a incref() call, and the Node.__del__() function a corresponding decref()? Or ?? Regards Joakim Hove -- http://mail.python.org/mailman/listinfo/python-list

Encoding and norwegian (non ASCII) characters.

2006-10-07 Thread joakim . hove
Hello, I am having great problems writing norwegian characters æøå to file from a python application. My (simplified) scenario is as follows: 1. I have a web form where the user can enter his name. 2. I use the cgi module module to get to the input from the user: name = form["name"]

Re: include statement

2006-09-19 Thread joakim . hove
Thanks to all who took time to answer! > > is it possible in python to include another python source file into the > > current namespace, i.e.completely analogous to the #include statement > > in C. [...] > Tell us why you are contemplating such a thing, and someone > here will help you impleme

include statement

2006-09-19 Thread joakim . hove
Hello, is it possible in python to include another python source file into the current namespace, i.e.completely analogous to the #include statement in C. Regards Joakim -- http://mail.python.org/mailman/listinfo/python-list

Re: __LINE__ and __FILE__ functionality in Python?

2006-08-13 Thread Joakim Hove
Maric Michaud <[EMAIL PROTECTED]> writes: > Sure, try : > > In [46]: import inspect > > In [47]: c=inspect.currentframe() > > In [48]: c.f_lineno > Out[48]: 1 > > In [49]: c.f_code.co_filename > Out[49]: '' Thanks a lot - that was just what I

__LINE__ and __FILE__ functionality in Python?

2006-08-13 Thread Joakim Hove
FILE__ and __LINE__ macros as: log_msg(msg , __FILE__ , __LINE__) Is there a way to emulate this behaviour in Python? Best Regards Joakim Hove [1]: It is not *that* simple, but you get the point. -- Joakim Hove hove AT ntnu.no/ Tlf: +47 (73 5)9 34 27/ St

Unicode & ZSI interaction ??

2006-05-13 Thread Joakim Hove
;/tmp/namelist.txt","a") fileH.write("name:%s ref:%s \n" % (name,ref)) fileH.close() This bombs with: UnicodeEncodeError: 'ascii' codec can't encode character u'\xc5' in position 45: ordinal not in range(128) The variable 'ref'

Become another user

2006-03-21 Thread Joakim Hove
' during execution? Best Regards Joakim Hove -- Joakim Hove hove AT ntnu.no/ Tlf: +47 (55 5)8 27 13/ Stabburveien 18 Fax: +47 (55 5)8 94 40 / N-5231 Paradis http://www.ift.uib.no/~hove// 55 91 28 18