ctypes-1.0.2 for 64-bit Windows

2007-05-15 Thread Thomas Heller
For the brave enough to run a 64-bit Python under a 64-bit Windows installation, I have added a first version of ctypes for win64 in the sourceforge download area. It does NOT use the same sourcecode as the 'official' version, the code has been patched by merging selected commits from the Python S

Re: calldll for Python 2.5

2007-05-16 Thread Thomas Heller
Larry Bates schrieb: > I've implemented several libraries using calldll (originally on > Python 2.2) and posted recipe on ASPN for a general implementation > http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/146847. > If I were doing it over again today, I would use ctypes, but I > have thous

Re: with ctypes, how to parse a multi-string

2007-05-31 Thread Thomas Heller
Eric schrieb: > Hi, > > I am currently dealing with ctypes, interfacing with winscard libbrary > (for smart card access). > > Several APIs (e.g. SCardListReaderGroupsW ) take a pointer to an > unicode string as a parameter , which points at function return to a > "sequence" of unicode strings, NU

Re: ming on win32 anyone ? [help a noob]

2007-08-15 Thread Thomas Heller
daz.diamond schrieb: > hoping someone can help ... > > how do I install ming (with python) on win32? have downloaded the > tar.gz of ming-0.3.0 which doesn't have a handy self-installer, and > I'm absolutely foxed as to what to do next ... the install > instructions in the package seem to be linux

Re: Move files/directories to Recycle Bin using standard Python libs

2007-08-15 Thread Thomas Heller
[EMAIL PROTECTED] schrieb: > On Aug 15, 11:39 am, Kevin D. Smith <[EMAIL PROTECTED]> wrote: >> I would like to move files and directories to the Recycle Bin on >> Windows from Python. I have found some older articles describing how >> to do this, but they require additional packages to be installe

Re: ctypes and C99 complex numbers

2007-08-16 Thread Thomas Heller
Eugen Wintersberger schrieb: > Hi there > I want to use ctypes in connection with C functions that use complex > datatypes defined in the C99 standard. Does someone know a simple way > how to implement this? Are there any plans to integrate the C99 complex > data types in the ctypes module? I hav

Re: Fatal Python error using ctypes & python exceptions

2007-08-31 Thread Thomas Heller
mmacrobert schrieb: > Hi Everyone, > I've created a 'C' dll that is accessed via ctypes library containing > a bunch of functions. I've successfully been able to use the > functions. However, I would like to throw python exceptions from some > of them. > > I throw them using: ::PyErr_SetString(::P

Re: py2exe - change name of exe created

2007-09-07 Thread Thomas Heller
imageguy schrieb: > Sorry for the double post, sent it to quickly. > > I have a setup script like this; > > setup(windows = [{"script":"myprogram.py", >"icon_resources":[(0,"nabbitt.ico")], > "other_resources": [(24,1,manifest)]} > ], > name

Re: debugging program that uses ctypes

2007-09-07 Thread Thomas Heller
[EMAIL PROTECTED] schrieb: > hi all, I have a python program that calls a dll through ctypes > (py2.5). In some (reproducible) > conditions the program crashes with an error in ctypes module. You mean a segfault? > How can I trace down the problem? I have created a debug build of > python but I a

Re: py2exe - change name of exe created

2007-09-07 Thread Thomas Heller
imageguy schrieb: [...] >> > Note that every thing works fine with this and creates an exe program >> > called >> > "myprogram.exe" >> >> > I would like to setup program to create an output called; >> > "MyBestProgram.exe" >> >> > IS that at all possible ? >> >> Yes. Use a 'dest_base' key in the d

Re: Get the complete command line as-is

2007-09-13 Thread Thomas Heller
wangzq schrieb: > On Sep 12, 3:20 pm, Laurent Pointal <[EMAIL PROTECTED]> wrote: >> wangzq a écrit : >> >> > Hello, >> >> > I'm passing command line parameters to my browser, I need to pass the >> > complete command line as-is, for example: >> >> > test.py "abc def" xyz >> >> > If I use ' '.join(sy

Re: py2exe: LoadLibrary(pythondll) failed

2007-03-03 Thread Thomas Heller
zxo102 schrieb: > Hi there, >I py2exe my test.py as test.exe with a lot of dll and pyc in that > directory. If I move the test.exe into another directory and run it > from there, it gives me an error " LoadLibrary(pythondll) failed... > python24.dll". How can I set it up correctly for this te

Re: C++ and Python

2007-03-10 Thread Thomas Heller
Alex Martelli schrieb: > hg <[EMAIL PROTECTED]> wrote: >... >> target but rather C: I need to integrate a printer driver and and would >> like if possible to avoid all of the .h stuff involved with SWIG (I am not >> being sarcastic): if I can setup my prototypes directly in python, why go >> th

Re: ANN: ActivePython 2.5.0.0 is now available

2007-03-15 Thread Thomas Heller
Trent Mick schrieb: > [EMAIL PROTECTED] wrote: >> >> is ctypes supported on ActivePython for Windows x64? >> > > No. > http://aspn.activestate.com/ASPN/docs/ActivePython/2.5/whatsincluded.html > > My understanding (from http://www.python.org/sf/1545507) is that ctypes isn't > yet ported to Win

Re: Technical Answer - Protecting code in python

2007-03-22 Thread Thomas Heller
Bart Willems schrieb: > Aaah, *now* we're getting somewhere... :-) > >>> All he wants is something that turns 'readable, >>> changeable python' into 'unreadable, immutable python'. >> >> chown scriptuser script.py # a unique user >> chmod a-rwx script.py >> chmod u+rx script.py >> >> I believe

Re: Create new processes over telnet in XP

2007-03-24 Thread Thomas Heller
Irmen de Jong schrieb: > Shane Geiger wrote: >> This reminds me of something I once wanted to do: How can I install >> Python in a totally non-gui way on Windows (without the use of VNC)? I >> think I was telnetted into a computer (or something like that) and I was >> unable to run the usual P

Re: python - dll access (ctypes or swig)

2007-04-18 Thread Thomas Heller
Alex Martelli schrieb: > Larry Bates <[EMAIL PROTECTED]> wrote: >... >> I guess I was the only one it wasn't "obvious" to . I've always >> written my COM servers as .EXE files even though they cannot be run >> independently. What I find is "odd" is that I can create a .DLL or an >> .EXE of my

Re: subprocess "handle is invalid" error

2007-04-18 Thread Thomas Heller
Grant Edwards schrieb: > I'm trying to use the py-gnuplot module on windows, and have > been unable to get it to work reliably under Win2K and WinXP. > > By default, it uses popen(gnuplotcmd,'w'), but in some > situations that consistently gets an "invalid operand" IOError > when write() is called

Re: Where's the Starship's crew?

2007-10-05 Thread Thomas Heller
Dick Moores schrieb: > > > I didn't check on all of them, but the only one I found was Mark > Hammond . > > Dick Moores > There are more. Think of it as a game you have to solve. -- http://mail.python.or

Re: Keeping track of subclasses and instances?

2007-10-10 Thread Thomas Heller
Karlo Lozovina schrieb: > Hi, > > what's the best way to keep track of user-made subclasses, and instances of > those subclasses? I just need a pointer in a right direction... thanks. > New style classes have a __subclasses__ class method that shows the direct subclasses: Python 2.4.4 (#71, Oc

Re: Getting error message/trace over the C API

2007-10-16 Thread Thomas Heller
Sami Vaisanen schrieb: > Hello group, > > I'm writing a C++ based application that embeds the python engine. Now I > have a problem regarding exception/error information. Is there a way to > get the exception message and possibly the traceback into a string for > example? I've been eyeballing the

Re: ANN: magnitude 0.9.2

2007-10-18 Thread Thomas Heller
Joan M. Garcia schrieb: > Following the feedback on the first release of magnitude it > has changed enough to deserve a second release, which > modifies the API, solves a couple of bugs, and brings it in > line with python's style guide. Main changes: > > * imul, idiv had wrong output unit, so th

Re: Is there a way to tell if a script has been run by Pythonw.exe instead of Python.exe?

2007-10-19 Thread Thomas Heller
Metalone schrieb: > Thanks to all, I learned something in each post. > When using py2exe to build an executable sys.executable does not > provide the name of the python interpreter but the name of the > executable generated by py2exe. > When running the executable built with py2exe you might be i

Re: Help ctypes on arm linux not compile

2007-10-30 Thread Thomas Heller
Samuel M. Smith schrieb: > I have built python 1.5.1 from source for an embedded ARM9 debian > linux Sarge distribution but > ctypes doesn't build. Anybody have any idea what the problem is? Do > I have to have the libffi package > installed. > See my errors below. ctypes won't work with Pyth

Re: trapping DLL import issues without blocking pop up window

2007-11-02 Thread Thomas Heller
alf schrieb: > Hi, > > there is following issue: "import cx_Oracle" on windows pops up a nice > 'DLL missing' window in case there indeed is no CLI.DLL (or something > like that). Then the exception is raised. > > Catching the exception is obviously not a problem, but the popup > practical

Re: py2exe: zipfile=None raised ImportError

2007-01-11 Thread Thomas Heller
(I forgot to copy the list ;-) Tim schrieb: > > I'm at the end of my limited experience... > > > > I'm using py2exe to create an executable. I'm using bundle level 1. > > When I don't use the zipfile option, the executable and library.zip get > > created and the executable works correctly. > > >

Re: how to unistall a Python package?

2007-01-26 Thread Thomas Heller
Colin J. Williams schrieb: > With Windows, a few packages, eg. PythonWin, also modify the registry. > numpy, the elaboration of numarray/numeric, and PythonWin have > RemoveXXX.exe in C:\Python25. > > I don't know whether this is the standard approach. There doesn't seem > to be a reference to

Re: Partial 1.0 - Partial classes for Python

2007-02-07 Thread Thomas Heller
Martin v. Löwis schrieb: > I'm happy to announce partial 1.0; a module to implement > partial classes in Python. It is available from > > http://cheeseshop.python.org/pypi/partial/1.0 > > A partial class is a fragment of a class definition; > partial classes allow to spread the definition of > a

Re: Partial 1.0 - Partial classes for Python

2007-02-07 Thread Thomas Heller
Carl Banks schrieb: > On Feb 7, 10:17 am, "Carl Banks" <[EMAIL PROTECTED]> wrote: >> On Feb 7, 8:51 am, Thomas Heller <[EMAIL PROTECTED]> wrote: >> >> >> >> > Martin v. Löwis schrieb: >> >> > > I'm happy to an

Re: Partial 1.0 - Partial classes for Python

2007-02-08 Thread Thomas Heller
Ziga Seilnacht schrieb: > Thomas Heller wrote: >> >> Do you have a pointer to that post? >> > > I think that he was refering to this post: > http://mail.python.org/pipermail/python-list/2006-December/416241.html > > If you are interested in various implem

Re: LoadLibrary(pythondll) failed

2007-02-10 Thread Thomas Heller
acncgc schrieb: > I get an following error as I turn on my laptop; > > LoadLibrary(pythondll) failed > > After this error internet browser ( IE or mozilla) doesn't connect. I > can't browse any site. > > Any idea?? > This looks like a message from a broken py2exe'd application. You have to fi

Re: pyinstaller fails to create exe-File

2007-02-23 Thread Thomas Heller
[EMAIL PROTECTED] schrieb: > Hi ! > > I am trying to create an exe file using pyinstaller. Running the > created exe-File gives the error message > "" > Traceback (most recent call last): > File "", line 8, in > File "E:\Documents\mich\job\abs\backup_skript\buildbackup\out1.pyz/ > email", lin

Re: Recreating a char array from a pointer

2007-02-24 Thread Thomas Heller
buffinator schrieb: > I have an application that has to send a string as a pointer to memory, > and then another one that has to retriece it and fetch the string. > Converting the string to an array and sending the pointer was easy > > import array > a=array.array("c","mytextgoeshere") > my_poin

Re: py2exe, library.zip and python.exe

2007-02-28 Thread Thomas Heller
Martin Evans schrieb: > I have converted a Python script using py2exe and have it set to not bundle > or compress. The result is my exe and all the support files including > library.zip (exactly as planned - nice job py2exe). > > Question: My py2exe application needs to be able to execute extra

Re: Py2EXE problem

2007-02-28 Thread Thomas Heller
Sick Monkey schrieb: > Ok I found an extremely easy way to resolving this issue (I cannot believe I > did not think of it sooner). > > After Py2exe created the .exe file I noticed a "library.zip" file. I took a > look at the Py2exe output, and saw all of the libraries that it failed to > insert.

PIL question

2007-11-16 Thread Thomas Heller
I'm trying to read an image with PIL, crop several subimages out of it, and try to combine the subimages again into a combined new one. This is a test script, later I want to only several single images into a combined one. I have to work with 16-bit color windows bitmaps in BMP format. My input

Re: PIL question

2007-11-16 Thread Thomas Heller
Thomas Heller schrieb: > I'm trying to read an image with PIL, crop several subimages out of it, > and try to combine the subimages again into a combined new one. This is > a test script, later I want to only several single images into a combined one. [...] > Here is the code;

Re: 2.5a1 import of .dlls

2006-04-18 Thread Thomas Heller
[EMAIL PROTECTED] wrote: > I've re-built an extension module (as a .dll) using the 2.5a1 release. > Unexpectedly, I'm not able to simply import it (not the way I can when > building it for 2.3). Using imp.load_dynamic() the import succeeds. > import minx # Implemented in a .dll - fails >

Re: win32com short path name on 2k

2006-04-26 Thread Thomas Heller
bytecolor wrote: > Hi people, > > Using win32com on 2k SP3... import win32com.client as w32c fc = w32c.Dispatch('Featurecam.Application') fc.InstallPath > u'C:\\PROGRA~1\\FEATUR~1' > > Using win32com on XP Professional SP2... import win32com.client as w32c fc = w32c.Dispa

Re: Importing modules through directory shortcuts on Windows

2006-04-26 Thread Thomas Heller
Brian Quinlan wrote: > Recently, I became responsible for maintaining some Python code, which > was organized as follows: > > user/pylib > ui > ... > project2/pylib > ui > ... > project3/pylib > ui > ... > python-packages/user => /user/pylib >

Re: A QFB agent: how to catch C-level crashes and last Python stack ?

2006-04-27 Thread Thomas Heller
robert wrote: > When employing complex UI libs (wx, win32ui, ..) and other extension > libs, nice "only Python stack traces" remain a myth. > > Currently I'm hunting again a rare C-level crash bug of a Python based > Windows app with rare user reports - and still in the dark (I get > snippets o

Re: os.startfile() - one or two arguments?

2006-04-28 Thread Thomas Heller
BartlebyScrivener wrote: > Can any Windows user give a working example of adding a "command verb" > to os.startfile()? > > When I try it, it squawks that it takes only one argument. > os.startfile('d:/','explore') > Traceback (most recent call last): > File "", line 1, in ? > TypeError: st

Re: Making all string literals Unicode

2006-05-15 Thread Thomas Heller
Richie Hindle wrote: > Hi, > > Am I imagining it, or is there a switch or an environment variable to > make Python treat all string literals as unicode? I seem to recall > seeing it mentioned somewhere, but now I can't find it anywhere. > > Thanks, > python -U -- http://mail.python.org/mailma

Re: ctypes - pointer to array of structs?

2008-01-04 Thread Thomas Heller
[EMAIL PROTECTED] schrieb: > (Is this the right place to ask ctypes questions? There's a mailing list > but the last post to it seems to have been in November 2006.) You could use the ctypes-users mailing list: https://lists.sourceforge.net/lists/listinfo/ctypes-users It is also available via gm

Re: pydepend (checking dependencies like jdepend) ?

2008-01-04 Thread Thomas Heller
Stefan Schukat schrieb: > No, py2exe does not display such information but has an algorithm to > collect such information. > Perhaps this is a starting point for you. If py2exe is run with the -x flag, it does display a cross-reference in a browser window. Thomas -- http://mail.python.org/mailm

Re: for loop without variable

2008-01-09 Thread Thomas Heller
erik gartz schrieb: > Hi. I'd like to be able to write a loop such as: > for i in range(10): > pass > but without the i variable. The reason for this is I'm using pylint > and it complains about the unused variable i. Pychecker won't complain if you rename 'i' to '_', IIRC: for _ in range(10)

Re: Embedding Python - Freeing Python Objects Not Using Py_DECREF

2008-01-17 Thread Thomas Heller
[EMAIL PROTECTED] schrieb: > Hello, > > I'm embedding Python interpreter in a Win32 console application. I use > C++. > > I would like to use the WinAPI LoadLibrary function to load the python > dll at runtime (followed by GetProcAddress calls), so that I have to > make no assumptions about the l

Re: ctypes CDLL - which paths are searched?

2008-01-21 Thread Thomas Heller
Helmut Jarausch schrieb: > Hi, > > how can I specify the paths to be searched for a dynamic library > to be loaded by ctypes' CDLL class on a Linux system. > > Do I have to set os.environment['LD_LIBRARY_PATH'] ? > ctypes passes the argument given to CDLL(path) straight to the dlopen(3) call, s

Re: ctypes CDLL - which paths are searched?

2008-01-22 Thread Thomas Heller
Helmut Jarausch schrieb: > Thomas Heller wrote: >> Helmut Jarausch schrieb: >>> Hi, >>> >>> how can I specify the paths to be searched for a dynamic library >>> to be loaded by ctypes' CDLL class on a Linux system. >>> >>> Do

Re: Python and binary compatibility

2008-01-24 Thread Thomas Heller
Ambush Commander schrieb: > I'm a newbie to Python; various packages I've used in the past (Lyx, > LilyPond and Inkscape, to name a few) have bundled Python with them > for various scripting needs, and Cygwin also had an install lying > around, so when I started to use Mercurial (also Python) I dec

Re: Windows AVIFile problems

2008-01-25 Thread Thomas Heller
c d saunter schrieb: > Hi All, > > I'm trying to access individual video frames of an AVI file from within > Python 2.4 or 2.5 under Windows XP. > > I have found this example code here for that does exactly what I want, > using the windows avifile.dll but I am unable to find the AVIFile.h > hea

Re: Why this ref leak?

2008-02-27 Thread Thomas Heller
Gerhard Häring schrieb: > import sys > > def foo(): > class C(object): > pass > > foo() > print ">>", sys.gettotalrefcount() > foo() > print ">>", sys.gettotalrefcount() > foo() > print ">>", sys.gettotalrefcount() > > >> 21366 > >> 21387 > >> 21408 > [9779 refs] > > Both Pytho

Re: app runs fine with interpreter, but not under py2exe

2008-03-16 Thread Thomas Heller
Doug Morse schrieb: > Peter, > > Genius! You nailed it -- thanks! > > py2exe is apparently getting confused by the fact that packages "Numeric" and > "numpy" both have files multiarray.pyd and umath.pyd. It copies just one of > each -- from $PYTHONHOME/Lib/site-packages/numpy/core -- and puts b

Re: comtypes question

2008-03-17 Thread Thomas Heller
Jorgen Bodde schrieb: > Hi All, > > I am trying to automate a 3rd party application, and all I have to > work on is the type library and some documentation. I hope a Python / > COM guru can answer this or put me on the right path because I don't > know why it does not work. > > First I imported t

Re: py2exe socket.gaierror (10093)

2008-03-26 Thread Thomas Heller
Knut schrieb: >> The script can't resolve the server name. Try to do it by hand using >> nslookup or even ping (you may want to add a few print statements inside >> the script to see the exact host name it is trying to connect to, in case >> it isn't what you expect) >> If you can't resolve the hos

Re: py2exe + SQLite problem

2009-01-31 Thread Thomas Heller
Armin schrieb: > As posted before ... set's my script (python 2.3): > > from distutils.core import setup > import py2exe > > setup(windows=['dpconf.py'], > data_files=[ "", ["proj_db","gsd_db","dachs2.xbm"]] > ) > > When I create the distribution I got the following err msg: > > *** c

Re: py2exe and distutils

2009-02-07 Thread Thomas Heller
Maxim Demenko schrieb: > Hi, > i have installed Python 2.5.4 on WinXP, setuptools-0.6c9 and py2exe 0.6.9 > Now i can't list installed modules, here is the stacktrace: > > > > help> modules > > Please wait a moment while I gather a list of all available modules... > > Traceback (most recent cal

Re: py2exe and distutils

2009-02-07 Thread Thomas Heller
> Maxim Demenko schrieb: >> Hi, >> i have installed Python 2.5.4 on WinXP, setuptools-0.6c9 and py2exe 0.6.9 >> Now i can't list installed modules, here is the stacktrace: [...] >> Any suggestion, how to fix this issue? > Thomas Heller schrieb: > Looks like a

Re: Easier to wrap C or C++ libraries?

2009-02-15 Thread Thomas Heller
Christian Heimes schrieb: > Hrvoje Niksic schrieb: >> "Diez B. Roggisch" writes: >> >>> The answer is easy: if you use C, you can use ctypes to create a >>> wrapper - with pure python, no compilation, no platform issues. >> >> The last part is not true. ctypes doesn't work on 64-bit >> architec

Re: Checking if an int fits in 32 bits?

2008-12-04 Thread Thomas Heller
Roy Smith schrieb: > I'm working with marshaling data over a binary wire protocol. I'm > using struct.pack() to handle the low-level encoding of ints. One of > the things I need to do is make sure an int can be represented in 4 > bytes. Is there a portable way to do that? For now, I'm doing sig

Re: ctypes and misaligned doubles

2008-12-11 Thread Thomas Heller
Jan Roelens schrieb: > Dear python experts, > > How can I change the alignment of types in the ctypes package? I have > a library that was built with gcc using the -malign-double option. I > also have python code that can create ctypes wrapper code from the > include files for that library. The pr

Re: ANN: New Book: Programming in Python 3

2008-12-19 Thread Thomas Heller
Mark Summerfield schrieb: > Just a follow-up to say that the book has now been published in the > U.S. > It is now in stock at InformIT, and should reach other stores, e.g., > Amazon, in a week or so. > > Also, the introduction, the first few pages of the first chapter, the > whole of chapter 12 (

Re: ANN: New Book: Programming in Python 3

2008-12-19 Thread Thomas Heller
Steve Holden schrieb: > Thomas Heller wrote: >> Question from a non-native english speaker: is this now valid english? >> >> "One of Python’s great strengths" >> ^ >> "and also teaches Python’s functional programming features&

Re: Extending Python with C or C++

2009-01-07 Thread Thomas Heller
Nick Craig-Wood schrieb: > Ralf Schoenian wrote: >> Ryan wrote: >> > I've been using Python for many years now. It's a wonderful language >> > that I enjoy using everyday. I'm now interested in getting to know >> > more about the guts (C/C++) and extending it. But, extending python >> > still see

Re: Extending Python with C or C++

2009-01-08 Thread Thomas Heller
Nick Craig-Wood schrieb: > Thomas Heller wrote: >> Nick Craig-Wood schrieb: >> > Interesting - I didn't know about h2xml and xml2py before and I've >> > done lots of ctypes wrapping! Something to help with the initial >> > drudge work of c

Re: how to get the thighest bit position in big integers?

2008-10-07 Thread Thomas Heller
Mark Dickinson schrieb: > On Oct 5, 11:40 pm, Terry Reedy <[EMAIL PROTECTED]> wrote: >> Your point, that taking floor(log2(x)) is redundant, is a good catch. >> However, you should have added 'untested' ;-). When value has more >> significant bits than the fp mantissa can hold, this expression can

no unbound methods in py3k

2008-10-08 Thread Thomas Heller
I'm currently using code like this to create unbound methods from functions and stick them into classes: method = new.instancemethod(raw_func, None, cls) setattr(cls, name, method) Ok, python 2.6, run with the -3 flag, gives a warning that the new module is going away in python 3.0, so the

Re: no unbound methods in py3k

2008-10-09 Thread Thomas Heller
Christian Heimes schrieb: > Thomas Heller wrote: >> but this is very ugly, imo. Is there another way? >> The raw_func instances that I have are not descriptors (they >> do not implement a __get__() method...) > > I've written PyInstanceMethod_Type for this use c

python 3: sorting with a comparison function

2008-10-09 Thread Thomas Heller
Does Python 3 have no way anymore to sort with a comparison function? Both [].sort() and sorted() seem to accept only 'key' and 'reverse' arguments, the 'cmp' argument seems to be gone. Can that be? Thomas -- http://mail.python.org/mailman/listinfo/python-list

Re: no unbound methods in py3k

2008-10-09 Thread Thomas Heller
Terry Reedy schrieb: > Thomas Heller wrote: >> Christian Heimes schrieb: >>> I've written PyInstanceMethod_Type for this use case. It's not (yet) >>> available for Python code.>> Oh, wait - there's ctypes: >> >> Python 3.0rc1 (r30rc1

Re: no unbound methods in py3k

2008-10-09 Thread Thomas Heller
Christian Heimes schrieb: > Thomas Heller wrote: >> Ok, so one has to write an extension to access or expose it. >> >> Oh, wait - there's ctypes: > > I wrote the type to help the Pyrex and Cython developers to port their > software to 3.0. I planed t

Re: python 3: sorting with a comparison function

2008-10-10 Thread Thomas Heller
> Thomas Heller wrote: >> Does Python 3 have no way anymore to sort with a comparison function? >> >> Both [].sort() and sorted() seem to accept only 'key' and 'reverse' >> arguments, >> the 'cmp' argument seems to be gone. Can that

Re: python 3: sorting with a comparison function

2008-10-10 Thread Thomas Heller
[EMAIL PROTECTED] schrieb: > Kay Schluehr: >> Sometimes it helps when people just make clear how they use technical >> terms instead of invoking vague associations. > > And generally Python docs can enjoy growing few thousands examples... Well, that may not be necessary. But I think that a clear

Re: 2.6, 3.0, and truly independent intepreters

2008-10-22 Thread Thomas Heller
Andy schrieb: > Dear Python dev community, > > [...] Basically, > we use embedded python and use it to wrap our high performance C++ > class set which wraps OpenGL, DirectX and our own software renderer. > In addition to wrapping our C++ frameworks, we use python to perform > various "worker" tas

Re: Passing a memory address (pointer) to an extension?

2008-10-22 Thread Thomas Heller
Philip Semanchuk schrieb: > I'm writing a Python extension in C that wraps a function which takes > a void * as a parameter. (The function is shmat() which attaches a > chunk of shared memory to the process at the address supplied by the > caller.) I would like to expose this function to Pyth

Re: C extension type gives type error in power operator

2008-11-20 Thread Thomas Heller
Paul Moore schrieb: > I'm trying to implement an extension type with a power operator. The > operator is unusual in that I want to allow my objects to be raised to > an integer power: > >p = Pattern() >p3 = p ** 3 > > I've implemented the code for a nb_power slot, it converts the "other"

pyreadline, InteractiveConsole, and tab completion on Windows

2009-04-03 Thread Thomas Heller
I have installed pyreadline, and get nice tab completion in the normal interactive interpreter: Python 2.4.4 (#71, Oct 18 2006, 08:34:43) [MSC v.1310 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> import rlcompleter >>> import readline >>> read

Re: ANN: PyGUI 2.0.1

2009-04-17 Thread Thomas Heller
greg schrieb: > Suraj Barkale wrote: > >> I installed this and tried out the tests on Python 2.6.1 and Windows XP >> SP3. Following are my observations. > > Thanks, I'll look into these. > >> Test 33-mouse-events.py: >> 1. mouse-enter and mouse-leave events are not reported. > > That's actu

Re: Windows Shell Extensions - Out of Proc

2009-04-23 Thread Thomas Heller
Ralf schrieb: > I'm trying to develop Windows Shell Extensions with the Python Win32 > Extensions. Most of the samples are working. However, I have a > slightly different need: I want the Python COM server to run as a > separate process ("LocalServer" or "OutOfProc"). > > As I understand, both the

Re: Windows Shell Extensions - Out of Proc

2009-04-23 Thread Thomas Heller
Ralf schrieb: >> I think that for whatever reasons, explorer always tries to create >> shell extensions as InProc. CoCreateInstance, which is the usual >> API to create COM instances, allows to specify which one you want. >> >> Thomas > > So there is no way to do this, other than to create a "pro

Re: Failed to build these modules:_ctypes

2009-04-24 Thread Thomas Heller
PS schrieb: > Hello all > > I can't install neither python 2.6.1 nor 2.6.2 because an error during > compilation of _ctypes module, I don't need the module but I don't > know how to instruct to skip it. You only get a warning, right? So a subsequent 'make install' should work. -- http://mail.pyt

Re: pythonCE GetSystemPowerState windows api

2009-04-25 Thread Thomas Heller
lorenzo.mentas...@yahoo.it schrieb: > Hi all, > I need to call GetSystemPowerState windows api from pythonCE, because > I need to know if a windows ce 5 device is in sleep/off status. > I can find this api in ctypes.windll.coredll, but I cannot figure out > how to pass parameters to this procedure:

Web framework for embedded system

2009-04-28 Thread Thomas Heller
I'm looking for a lightweight web-framework for an embedded system. The system is running a realtime linux-variant on a 200 MHz ARM processor, Python reports a performance of around 500 pystones. The web application will not be too fancy, no databases involved for example, but it will need to cont

Re: Web framework for embedded system

2009-04-29 Thread Thomas Heller
Thomas Heller schrieb: > I'm looking for a lightweight web-framework for an embedded system. > The system is running a realtime linux-variant on a 200 MHz ARM > processor, Python reports a performance of around 500 pystones. > > The web application will not be too fancy, n

json vs. simplejson

2009-05-13 Thread Thomas Heller
Python 2.6 contains the json module, which I thought was the renamed (and improved?) simplejson module that also works on older Python versions. However, it seems the json is a lot slower than simplejson. This little test, run on Python 2.6.2 and WinXP shows a dramatic difference: C:\>py26 -m

Re: Fwd: Re: Unable to install Pywin32 for Python 2.6.2

2009-05-13 Thread Thomas Heller
David Lyon schrieb: > On Wed, 13 May 2009 05:32:16 +0200, "Martin v. Löwis" > wrote: > >> I think this was a case of obscure misconfiguration of the system. >> It is always possible to configure a system in such a way that even >> the most resilient installation procedure will break. > > Techni

Re: json vs. simplejson

2009-05-13 Thread Thomas Heller
Diez B. Roggisch schrieb: > Thomas Heller wrote: > >> Python 2.6 contains the json module, which I thought was the renamed (and >> improved?) simplejson module that also works on older Python versions. >> >> However, it seems the json is a lot slower than simplejso

Re: json vs. simplejson

2009-05-13 Thread Thomas Heller
Ned Deily schrieb: > In article <76vs9tf1f6c5...@mid.individual.net>, > Thomas Heller wrote: >> Diez B. Roggisch schrieb: >> > Thomas Heller wrote: >> >> Python 2.6 contains the json module, which I thought was the renamed (and >> >> improved?

Re: Using C++ and ctypes together: a vast conspiracy? ;)

2009-06-04 Thread Thomas Heller
Joseph Garvin schrieb: > So I was curious whether it's possible to use the ctypes module with > C++ and if so how difficult it is. There have been some attempts to use ctypes to access C++ objects. We (Roman Yakovenko and myself) made some progress. We were able to handle C++ name mangling, the s

Re: Using C++ and ctypes together: a vast conspiracy? ;)

2009-06-04 Thread Thomas Heller
[Please keep the discussion on the list] Joseph Garvin schrieb: > On Thu, Jun 4, 2009 at 3:43 AM, Thomas Heller wrote: >> There have been some attempts to use ctypes to access C++ objects. >> We (Roman Yakovenko and myself) made some progress. We were able to >> handle C

Re: Using C++ and ctypes together: a vast conspiracy? ;)

2009-06-04 Thread Thomas Heller
Philip Semanchuk schrieb: > Hi Thomas, > We're weighing options for accessing C++ objects via Python. I know of > SIWG and Boost; are there others that you think deserve consideration? I haven't used any of them myself. A common suggestion is SIP, less known are pybindgen and Robin. But there

Re: ctype question

2009-06-04 Thread Thomas Heller
Amit Gupta schrieb: > Hi, > > I have been using ctype.cdll to load a library, but I am unable to > figure out how to load multiple libraries that depends on each other. > E.g. I have two libraries A.so and B.so. A.so has some undefined > references, and those symbols are defined in B.so. > > When

Re: Using C++ and ctypes together: a vast conspiracy? ;)

2009-06-05 Thread Thomas Heller
Joseph Garvin schrieb: > On Thu, Jun 4, 2009 at 3:23 PM, Brian wrote: >> What is the goal of this conversation that goes above and beyond what >> Boost.Python + pygccxml achieve? > > I can't speak for others but the reason I was asking is because it's > nice to be able to define bindings from wit

Re: Access to sysctl on FreeBSD?

2008-05-20 Thread Thomas Heller
Skye schrieb: > Great, thanks for the help (I'm fairly new to Python, didn't know > about ctypes) > > from ctypes import * > libc = CDLL("libc.so.7") > size = c_uint(0) > libc.sysctlbyname("net.inet.ip.stats", None, byref(size), None, 0) > buf = c_char_p(" " * size.value) >

Re: [ctypes] convert pointer to string?

2008-05-21 Thread Thomas Heller
Neal Becker schrieb: > In an earlier post, I was interested in passing a pointer to a structure to > fcntl.ioctl. > > This works: > > c = create_string_buffer (...) > args = struct.pack("iP", len(c), cast (pointer (c), c_void_p).value) > err = fcntl.ioctl(eos_fd, request, args) > > Now to do the

Re: Instructions on how to build py2exe 0.6.8 (or an installer would be nice, too!)

2008-06-10 Thread Thomas Heller
[EMAIL PROTECTED] schrieb: > Hello, > > I'm trying to build an executable with py2exe, but unfortunately the > version I have is 0.6.6, which has a rather annoying bug that doesn't > let you rename the executable file if you bundle everything in a > single executable. It seems fairly unacceptable

Re: Calling pcre with ctypes

2008-06-18 Thread Thomas Heller
moreati schrieb: > Recently I discovered the re module doesn't support POSIX character > classes: > > Python 2.5.2 (r252:60911, Apr 21 2008, 11:12:42) > [GCC 4.2.3 (Ubuntu 4.2.3-2ubuntu7)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. import re r = re

Re: python.exe crash and ctypes use

2008-07-23 Thread Thomas Heller
waldek schrieb: > Hi, > > I have module A.py and B.dll which exports C functions by cdecl_ > > In A.py I pass callback (py callable) to dll. Next, thread inside dll > simply calls my callback (in a loop). After few secs I got crash of > python.exe. > > How to debug it? > > I'm using winxp and

Re: ctypes and reading value under pointer passed as param of a callback

2008-07-24 Thread Thomas Heller
waldek schrieb: > Hi, > > I'm using C dll with py module and wanna read value (buffer of bytes) > returned in py callback as parameter passed to dll function. > The callback receives a pointer instance. You can dereference the pointer to read individual bytes in this way: print data[0], data

Re: Working with ctypes and char** data type

2008-07-24 Thread Thomas Heller
Philluminati schrieb: > I'm a bit of a python newbie and I need to wrap a C library. > > I can initialise the library using CDLL('mcclient.so') > > and I can call functions correctly inside the library but I need to > invoke one function which has this function definition: > > char ** CAPAPI McS

<    1   2   3   4   5   >