Re: very lightweight gui for win32 + python 3.4

2014-09-13 Thread Thomas Heller
Am 13.09.2014 03:19, schrieb Grant Edwards: On 2014-09-12, Thomas Heller wrote: Am 12.09.2014 18:38, schrieb Chris Angelico: Does Tkinter really work well with cx_Freeze? I doubt it (from my experiences with py2exe). I never had any problems with Tkinter and py2exe, but you do get a

Re: very lightweight gui for win32 + python 3.4

2014-09-12 Thread Thomas Heller
Am 12.09.2014 18:38, schrieb Chris Angelico: On Sat, Sep 13, 2014 at 2:35 AM, Nagy László Zsolt wrote: So I need to create a GUI mode version of my program. That the customer should be able to see a progress bar. What kind of GUI toolkit should I use for this? I would like this to be lightweigh

Re: Distributing python applications as a zip file

2014-07-23 Thread Thomas Heller
Am 23.07.2014 06:23, schrieb Steven D'Aprano: A little known feature of Python: you can wrap your Python application in a zip file and distribute it as a single file. The trick to make it runnable is to put your main function inside a file called __main__.py inside the zip file. Look here: htt

Re: comtypes

2014-06-21 Thread Thomas Heller
Am 21.06.2014 09:08, schrieb peter.balazo...@emspin.com: Dears, I am not sure I am at right place here. Now I've started working with comtypes 1.1.0 package within python 2.7.6.1. I have ActiveX COM object I want access and work with it. I do following from comtypes.client import CreateObjec

Re: Best practices to overcome python's dynamic data type nature

2014-02-14 Thread Thomas Heller
Am 14.02.2014 17:32, schrieb Ethan Furman: On 02/14/2014 08:10 AM, Sam wrote: Dynamic data type has pros and cons. It is easier to program but also easier to create bugs. What are the best practices to reduce bugs caused by Python's dynamic data-type characteristic? Can the experienced Pytho

Re: Packaging a private project

2013-12-17 Thread Thomas Heller
Am 16.12.2013 12:18, schrieb Nicholas Cole: Dear List, What is the best way to distribute a private, pure python, Python 3 project that needs several modules (some available on pypi but some private and used by several separate projects) in order to run? I'd like to include everything that my p

Re: how to get raw bytes for ctypes functions that return c_wchar_p

2013-11-19 Thread Thomas Heller
Am 19.11.2013 17:58, schrieb Mark Summerfield: Hi, I am using ctypes to access a function in a DLL using Python 3.3 32-bit on Windows 7 64-bit: dplGetPageText = dpl.DPLGetPageText dplGetPageText.argtypes = (ctypes.c_int, ctypes.c_int) dplGetPageText.restype = ctypes.c_wchar_p Python returns th

Terry Jones: "Monty Python to reunite for stage show"

2013-11-19 Thread Thomas Heller
"All of the surviving members of comedy group Monty Python are to reform for a stage show, one of the Pythons, Terry Jones, has confirmed." See: http://www.bbc.co.uk/news/entertainment-arts-24999401 Thomas -- https://mail.python.org/mailman/listinfo/python-list

Re: Problems with subclassing enum34

2013-06-28 Thread Thomas Heller
Am 28.06.2013 17:25, schrieb Thomas Heller: Robert Kern: enum.EnumMeta uses super() in its __new__() implementation but _ctypes.PyCSimpleType doesn't. Thus, only _ctypes.PyCSimpleType.__new__() gets a chance to run. Switching the order of the two might work. Robert found the proble

Re: Problems with subclassing enum34

2013-06-28 Thread Thomas Heller
Am 28.06.2013 17:16, schrieb Ethan Furman: On 06/28/2013 03:48 AM, Thomas Heller wrote: trying out the enum34 module. What I want to create is a subclass of enum.Enum that is also based on ctypes.c_int so that I can better use enum instances in ctypes api calls. Have you tried using

Problems with subclassing enum34

2013-06-28 Thread Thomas Heller
trying out the enum34 module. What I want to create is a subclass of enum.Enum that is also based on ctypes.c_int so that I can better use enum instances in ctypes api calls. When I do this, I get a metaclass conflict: >>> class MyEnum(ctypes.c_int, enum.Enum): ...FOOBAR = 0 ... Traceback

Re: Unicode

2013-03-15 Thread Thomas Heller
Am 15.03.2013 11:58, schrieb Steven D'Aprano: On Fri, 15 Mar 2013 11:46:36 +0100, Thomas Heller wrote: [Windows: Problems with unicode output to console] You can isolate the error by noting that the second one only raises an exception when you try to print it. That suggests that the pr

Unicode

2013-03-15 Thread Thomas Heller
I thought I understand unicode (somewhat, at least), but this seems not to be the case. I expected the following code to print 'µm' two times to the console: # -*- coding: cp850 -*- a = u"µm" b = u"\u03bcm" print(a) print(b) But what I get is this: µm Traceback (most recent call last):

Re: A new webpage promoting Compiler technology for CPython

2013-02-17 Thread Thomas Heller
Am 15.02.2013 08:11, schrieb Travis Oliphant: Hey all, With Numba and Blaze we have been doing a lot of work on what essentially is compiler technology and realizing more and more that we are treading on ground that has been plowed before with many other projects. So, we wanted to create a web

Re: Python launcher (PEP 397) and emacs python-mode.el

2013-01-31 Thread Thomas Heller
Am 31.01.2013 12:05, schrieb Andreas Röhler: Am 31.01.2013 10:03, schrieb Thomas Heller: Has someone managed to patch python-mode.el to use the PEP 397 python launcher when you hit C-c C-c? It seems that emacs should parse the shebang line in the edited python script and pass the corresponding

Python launcher (PEP 397) and emacs python-mode.el

2013-01-31 Thread Thomas Heller
Has someone managed to patch python-mode.el to use the PEP 397 python launcher when you hit C-c C-c? It seems that emacs should parse the shebang line in the edited python script and pass the corresponding arguments to py.exe. Thomas -- http://mail.python.org/mailman/listinfo/python-list

Re: The best, friendly and easy use Python Editor.

2013-01-24 Thread Thomas Heller
Am 24.01.2013 16:54, schrieb rusi: [I personally use emacs. It would be sadistic to make that into a recommendation] It would be truly sadistic to force a long-time emacs user to any other editor. Thomas -- http://mail.python.org/mailman/listinfo/python-list

Re: 2to6 ?

2012-07-02 Thread Thomas Heller
Am 27.06.2012 20:06, schrieb Terry Reedy: On 6/27/2012 10:36 AM, Thomas Heller wrote: Is there a tool, similar to 2to3, which converts python2 code to code using six.py, so that it runs unchanged with python2 *and* python 3? Others have expressed a similar wish, but I do not know that anyone

2to6 ?

2012-06-27 Thread Thomas Heller
Is there a tool, similar to 2to3, which converts python2 code to code using six.py, so that it runs unchanged with python2 *and* python 3? Thomas -- http://mail.python.org/mailman/listinfo/python-list

Re: mmap and bit wise twiddling - Raspberry Pi

2012-05-02 Thread Thomas Heller
Am 02.05.2012 22:05, schrieb Thomas Heller: class GPIO(BitVector): def __init__(self, address, value=0xFF, nbits=8): self.address = address super(GPIO, self).__init__(value, nbits) def _get_value(self): "read an 8-bit value from the hardware as 8-bit in

Re: mmap and bit wise twiddling - Raspberry Pi

2012-05-02 Thread Thomas Heller
Am 02.05.2012 19:40, schrieb Petr Jakes: Hi, I am trying to work with HW peripherals on Raspberry Pi To achieve this, it is necessary read/write some values from/to the memory directly. I am looking for some wise way how to organize the bit twiddling. To set some specific bit, for example, it i

Re: Finding x is 1, and x is 'foo' comparisons in a code base

2012-01-17 Thread Thomas Heller
Am 17.01.2012 18:10, schrieb Alex Willmer: Hello, I'm looking for a way to find the occurrences of x is y comparisons in an existing code base. Except for a few special cases (e.g. x is [not] None) they're a usually mistakes, the correct test being x == y. However they happen to work most of the

Re: os.startfile: Why is there no arguments option?

2011-10-12 Thread Thomas Heller
Am 12.10.2011 10:22, schrieb Christian Wutte: Hello all, as stated in the docs [1] os.startfile relies on Win32 ShellExecute(). So maybe someone can explain it to me, why there is no support for program arguments. That's quite a pity since os.startfile is the easiest way for an elevated run (with

Re: List of WindowsError error codes and meanings

2011-05-26 Thread Thomas Heller
Am 20.05.2011 19:56, schrieb Andrew Berg: This is probably somewhat off-topic, but where would I find a list of what each error code in WindowsError means? WindowsError is so broad that it could be difficult to decide what to do in an except clause. Fortunately, sys.exc_info()[1][0] holds the spe

Re: Problem receiving UDP broadcast packets.

2011-04-20 Thread Thomas Heller
Am 20.04.2011 00:21, schrieb Grant Edwards: I'm have problems figuring out how to receive UDP broadcast packets on Linux. [...] On the receiving machine, I've used tcpdump to verify that broadcast packets are being seen and have a destination IP of 255.255.255.255 and destination MAC of ff:ff:

Re: Windows - select.select, timeout and KeyboardInterrupt

2010-05-06 Thread Thomas Heller
Paul Moore schrieb: >>From a quick experiment, it seems that select.select with a timeout > doesn't react to a keyboard interrupt until the timeout expires. > Specifically, if I do > > s = socket.socket() > select.select([s], [], [], 30) > > and then press Ctrl-C, Python waits for the 30 seconds

Re: ctypes: delay conversion from c_char_p to string

2010-04-24 Thread Thomas Heller
Brendan Miller schrieb: > I have a function exposed through ctypes that returns a c_char_p. > Since I need to deallocate that c_char_p, it's inconvenient that > ctypes copies the c_char_p into a string instead of giving me the raw > pointer. I believe this will cause a memory leak, unless ctypes is

Re: Splitting a string

2010-04-02 Thread Thomas Heller
Patrick Maupin schrieb: > On Apr 2, 6:24 am, Peter Otten <__pete...@web.de> wrote: >> Thomas Heller wrote: >> > Maybe I'm just lazy, but what is the fastest way to convert a string >> > into a tuple containing character sequences and integer numbers, like >

Splitting a string

2010-04-02 Thread Thomas Heller
Maybe I'm just lazy, but what is the fastest way to convert a string into a tuple containing character sequences and integer numbers, like this: 'si_pos_99_rep_1_0.ita' -> ('si_pos_', 99, '_rep_', 1, '_', 0, '.ita') Thanks for ideas, Thomas -- http://mail.python.org/mailman/listinfo/python-li

Re: libc Sleep api performs a busy waiting

2010-03-09 Thread Thomas Heller
Joe Fox schrieb: > Hi, > > actually i have simplified my scenario a lot here , > > In my actual case , i have to call a C-api which blocks on c select , in a > separate thread. > > my thread is getting struck in that api , and thus blocking all the other > threads. > Can you point to something

Re: ctypes: How to call unexported functions in a dll

2010-01-05 Thread Thomas Heller
Am 05.01.2010 12:19, schrieb Coert Klaver (DT): > Hi, > > I am using ctypes in python 3 on a WXP machine > > Loading a dll and using its exported functions works fine. > > Now I want to use a function in the dll that is not exported. > > In C this can be done by just casting the address in the

Re: bootstrapping on machines without Python

2009-11-13 Thread Thomas Heller
M.-A. Lemburg schrieb: > Jonathan Hartley wrote: >> While examining py2exe et al of late, my thoughts keep returning to >> the idea of writing, in C or similar, a compiled stand-alone >> executable 'bootstrapper', which: >> 1) downloads and install a Python interpreter if none exists >> 2) runs the

Re: Is it possible to disable readline in the interactive interpreter?

2009-06-08 Thread Thomas Heller
Paul Moore schrieb: > I run Python on Windows. I have the (pure Python) pyreadline package > installed for (occasional) use by IPython. However, when I use the > normal Python interactive prompt, the mere fact that the readline > module exists means that it gets used. > > Is there a way of disabli

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

2009-06-05 Thread Thomas Heller
Philip Semanchuk schrieb: > On Jun 5, 2009, at 10:13 AM, Thomas Heller wrote: > >> s...@pobox.com schrieb: >>>>> If there is no C++ compiler available then the proposed layout >>>>> sniffing just >>> wouldn't be done and eithe

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

2009-06-05 Thread Thomas Heller
s...@pobox.com schrieb: > >> Requiring that the C++ compiler used to make the dll's/so's to be the > >> same one Python is compiled with wouldn't be too burdensome would it? > > Scott> And what gave you then impression that Python is compiled with a > Scott> C++ compiler? > > I do

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: 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-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: 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
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: 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: 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: 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

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: 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

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: 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:

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: 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: 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: 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

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: 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: 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: 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 + 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: 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: 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: 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: 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: 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: 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: 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"

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: 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: 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: 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: 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: 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

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
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

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: 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

Re: Directshow in Python

2008-09-18 Thread Thomas Heller
Sayanan Sivaraman schrieb: > Hey all, > > I'm trying to use DirectShow to display videos [I'm kind of new to > Python, from more of a C++ background on windows]. I found some > sample code online, but I am having trouble with calling the I > > import ctypes > from ctypes import * > from comtypes

Re: handling uncaught exceptions with pdb?

2008-09-12 Thread Thomas Heller
Paul Rubin schrieb: > I think I've asked about this before, but is there a way to set up > Python to handle uncaught exceptions with pdb? I know about setting > sys.except_hook to something that calls pdb, but this is normally done > at the outer level of a program, and by the time that hook gets

Re: ctypes error on Windows

2008-09-05 Thread Thomas Heller
Fredrik Lundh schrieb: > Fredrik Lundh wrote: > >>> I do have the tidy.dll installed (if I didn't, I couldn't even import >>> the tidy module). >> >> typing the following into the Python interpreter might give you some >> more clues: >> >> >>> import _tidy >> >>> _tidy.__file__ >>

Re: logging - how to use in a library?

2008-08-29 Thread Thomas Heller
Vinay Sajip schrieb: > On Aug 27, 11:28 am, Thomas Heller <[EMAIL PROTECTED]> wrote: >> >> I came up with a workaround that seems to do what I want. I add a NULL >> handler >> to my top-level logger which is not the root logger but a logger named >>

Re: ctypes version mismatch

2008-08-29 Thread Thomas Heller
Paul McNett schrieb: > Anyone have anything to suggest on this error: > > {{{ > Traceback (most recent call last): >File "shutter_studio.py", line 41, in >File "App.pyo", line 25, in >File "ui\__init__.pyo", line 23, in >File "ui\FrmProductionOrders.pyo", line 10, in >File

Re: logging - how to use in a library?

2008-08-27 Thread Thomas Heller
Vinay Sajip schrieb: > Suppose a user of logging configures it wrongly by mistake, so that > there are no handlers configured. In this case, if the logging system > were not to output anything at all, then you would have no information > at all about why - leading to a longer time to diagnose the

logging - how to use in a library?

2008-08-26 Thread Thomas Heller
I'm using the logging module in my comtypes library to log 'interesting' things that happen. In other words, the idea is if the user of the library is interested in the details that happen in the package internally, he (she?) would configure a logging level and handlers that write the log messages

Re: CAB files

2008-08-08 Thread Thomas Heller
Virgil Stokes schrieb: > I would appreciate python code for creating *.cab files. > > --V. Stokes Here is some code that I have still laying around. It has never been used in production and I do not know what you can do with the cab files it creates, but I have been able to create a cab and open

Re: ctypes and how to copy data passed to callback

2008-07-28 Thread Thomas Heller
waldek schrieb: > Hi, > > I'm trying to handle data passed to Py Callback which is called from > C dll. Callback passes data to another thread using Queue module and > there the data are printed out. > > If data is printed out in a callback itself it's ok. If I put on > queue and next get from

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

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: 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: 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: 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: [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: 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: py2exe Icon Resources

2008-04-30 Thread Thomas Heller
[EMAIL PROTECTED] schrieb: > I have created an app using python and then converting it to an exe > using py2exe, and have the following code: > > "icon_resources": [(1, "appFavicon.ico"), (2, "dataFavicon.ico")] > > in my py2exe setup file, the appFavicon works fine and it sets that as > the app

Re: Ignoring windows registry PythonPath subkeys

2008-04-04 Thread Thomas Heller
Floris Bruynooghe schrieb: > Hi > > We basically want the same as the OP in [1], i.e. when python starts > up we don't want to load *any* sys.path entries from the registry, > including subkeys of the PythonPath key. The result of that thread > seems to be to edit PC/getpathp.c[2] and recompile.

Re: State of ctypes Support on HP-UX?

2008-04-03 Thread Thomas Heller
Phil Thompson schrieb: > On Thursday 03 April 2008, Thomas Heller wrote: >> Phil Thompson schrieb: >> > Could somebody confirm how well ctypes is supported on HP-UX (for both >> > PA-RISC and Itanium) for both Python v2.4 and v2.5? >> I cannot answer your questi

Re: State of ctypes Support on HP-UX?

2008-04-03 Thread Thomas Heller
Phil Thompson schrieb: > Could somebody confirm how well ctypes is supported on HP-UX (for both > PA-RISC > and Itanium) for both Python v2.4 and v2.5? > > I don't have access to an HP system and Google doesn't come up with a > definitive answer (which may just mean it works fine, but prior exp

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: 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: 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: 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: 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: 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: 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

  1   2   3   4   5   >