Re: ValueError: invalid literal for float(): -1.#IND (pickle.py)

2010-07-14 Thread Alexander Eisenhuth
Mark Dickinson schrieb: BTW: I'm tied to version 2.5 of python Have you tried using pickle protocol 1 or 2, instead of pickle protocol 0? That may well solve your problem. (Those protocols write out the binary form of a float directly, instead of reading and writing a string

ValueError: invalid literal for float(): -1.#IND (pickle.py)

2010-07-12 Thread Alexander Eisenhuth
Hello together, python: 2.5.1 palttform: winXP I'm using pickle.dump and pickle.load with data that is created in a wrapped (boost.python) piece of C++ code. pickle.dump works fine. pickle.load creates the following exception: [...] data = pickle.load(input) File

Howto write XML file with comments?

2010-07-08 Thread Alexander Eisenhuth
Hello, - I've to write a XML document including comments - the document should be formatted that it could be viewed with a text editor What is the fastest (time for realization) approach doing it in python 2.5? Any help or hints are very welcome Thanks Alexander --

Re: Howto write XML file with comments?

2010-07-08 Thread Alexander Eisenhuth
Stefan Behnel schrieb: Alexander Eisenhuth, 08.07.2010 11:08: - I've to write a XML document including comments write in the sense of typing in a text editor? Or constructing one programmatically in memory? Or ... ? write means write to a file And what kind of data from what kind

Re: Howto write XML file with comments?

2010-07-08 Thread Alexander Eisenhuth
Sorry for my little riddle, but you solved it quite good with: - http://effbot.org/zone/element-lib.htm#prettyprint and comments are also in ElementTree (xml.etree.ElementTree.Comment) Thanks Stefan Behnel schrieb: Alexander Eisenhuth, 08.07.2010 12:07: Stefan Behnel schrieb: Alexander

__slot__: what is it good for?

2010-06-21 Thread Alexander Eisenhuth
Hello out there, - what is the reason, that __slots__ are introduced in python? - I want to use slots to define a class where no attributes are added at runtime. Is that a good idea to use slots for that? Regards Alexander -- http://mail.python.org/mailman/listinfo/python-list

(pywin related) pywintypes.com_error: -2147417846 Application busy

2009-11-25 Thread Alexander Eisenhuth
Hello list, I'm having a problem with a python COM Excel client that rarely gets the exception pywintypes.com_error with the error code -2147417846. (means Excel is busy) Here the python code of the exception handling: [...] try: # write a excel cell [...] except pywintypes.com_error,

Re: (pywin related) pywintypes.com_error: -2147417846 Application busy

2009-11-25 Thread Alexander Eisenhuth
I don't think so, because it happens very rarely Michel Claveau - MVP schrieb: Hi! Your computer is too slow, for launch Excel. Configure the machine for more speed... @+ -- http://mail.python.org/mailman/listinfo/python-list

boost.python Event object wrapped with bp::object()

2008-02-13 Thread Alexander Eisenhuth
Hello everybody, I Use a C++ thread that is called from the python sides to provoke some activities. The calls set some booleans in the thread object and return. To synchrThreadClassonize the execution in the thread, the idea of me is, to give a Python Event() object as bp::object to the C++

PyGILState_Ensure() produces a deadlock

2008-02-07 Thread Alexander Eisenhuth
Hello, In my mixed C++ / Python Application there are situations where a PyGILState_STATE gil_state = PyGILState_Ensure() produces a deadlock. The background is that a call fro python to cpp is directed to another subsystem that tries to access the GIL (through my C++ wrapper) from another

PyQt disconnect signal / slot

2007-09-25 Thread Alexander Eisenhuth
Hello PyQt experts, do i have to disconnect all signal/slots, after the emitting object is deleted, or does it the QObject destructor? Thanks Alexander -- http://mail.python.org/mailman/listinfo/python-list

Re: PyQt disconnect signal / slot

2007-09-25 Thread Alexander Eisenhuth
Phil, thanks for that quick reply Phil Thompson schrieb: On Tuesday 25 September 2007, Alexander Eisenhuth wrote: Hello PyQt experts, do i have to disconnect all signal/slots, after the emitting object is deleted, or does it the QObject destructor? It's done for you - same as Qt. Phil

Re: Class design (information hiding)

2007-09-07 Thread Alexander Eisenhuth
Bruno Desthuilliers schrieb: Nope. It's either 'interface' (no leading underscore), 'implementation' (single leading underscore), 'implementation with some protection against accidental overriding' (two leading underscores). What do you mean with 'implementation'? What does it express? --

Class design (information hiding)

2007-09-07 Thread Alexander Eisenhuth
Hi all, I'm wodering how the information hiding in python is ment. As I understand there doesn't exist public / protected / private mechanism, but a '_' and '__' naming convention. As I figured out there is only public and private possible as speakin in C++ manner. Are you all happy with

What does rany text mean ?

2007-08-15 Thread Alexander Eisenhuth
... as you can find in os.py at line 1 ? Regards Alexander -- http://mail.python.org/mailman/listinfo/python-list

Memory leak in PyQt application

2007-06-28 Thread Alexander Eisenhuth
Hello alltogether, My System: Python 2.5.1 Boost.Python Qt 4.2.2 SIP 4.6 PyQt 4.2 WinXp I've a memory leak in a PyQt application and no idea how to find it. What happens in the application ? From QWindow a QDialog is called on a button pressed() signal, that instantiate a QThread and waits

Re: Anyone else has seen forrtl: error (200) ...

2007-05-31 Thread Alexander Eisenhuth
Jason schrieb: Forrtl indicates that your script is running a Fortran library or program. Remember that Python exceptions only apply during Python. If a Fortran DLL performs a divide-by-zero error, or accesses invalid memory, it will kill the interpreter instead of throwing a Python

Re: PEP 8 style enforcing program

2007-05-31 Thread Alexander Eisenhuth
[EMAIL PROTECTED] schrieb: Some recent posts about Python programming style got me thinking. Since we have the PEP 8 which gives some guidelines about the style to be used, do we have any program that can check for violations of these guidelines within the source code? I understand that there

Anyone else has seen forrtl: error (200) ...

2007-05-30 Thread Alexander Eisenhuth
Hello, Ctrl+C is not passed to the interpreter (i guess it) while I'm executing a script. Instead i get: forrtl: error (200): program aborting due to control-C event If I start python in interactive mode Ctrl+C is passed: bash-3.2$ python Python 2.5 (r25:51908, Sep 19 2006, 09:52:17) [MSC

PyQt: Is signal / slot really working across threads?

2007-05-29 Thread Alexander Eisenhuth
Hello pyqt users, i tried to use signal / slot across threads. With the following example I want to emit a signal when the thread loop is entered. The connected slot is never called. Why? Any help is very welcome ... Alexander import time import sys import PyQt4 from PyQt4.QtCore import

Re: PyQt: Is signal / slot really working across threads?

2007-05-29 Thread Alexander Eisenhuth
Ok, thanks. Phil Thompson schrieb: On Tuesday 29 May 2007 11:58 am, Alexander Eisenhuth wrote: Hello pyqt users, i tried to use signal / slot across threads. With the following example I want to emit a signal when the thread loop is entered. The connected slot is never called. Why? Any

String formatting with fixed width

2007-03-16 Thread Alexander Eisenhuth
Hello alltogether, is it possible to format stings with fixed width of let's say 7 character. T need a floating point with 3 chars before dot, padded with ' ' and 3 chars after dot, padded with '0'. Followingh is my approach f = 21.1 s = %.03f % f s '21.100' But there are missing ' '.

String formatting with fixed width

2007-03-16 Thread Alexander Eisenhuth
Hello alltogether, is it possible to format stings with fixed width of let's say 7 character. T need a floating point with 3 chars before dot, padded with ' ' and 3 chars after dot, padded with '0'. Followingh is my approach f = 21.1 s = %.03f % f s '21.100' But there are missing ' '.

Re: String formatting with fixed width

2007-03-16 Thread Alexander Eisenhuth
Thanks for your fast reply. I'm fine with your %7.03f solution. (negatives are not significant) Alexander Eisenhuth schrieb: Hello alltogether, is it possible to format stings with fixed width of let's say 7 character. T need a floating point with 3 chars before dot, padded

Howto find dict members from a list of keys

2007-03-08 Thread Alexander Eisenhuth
Hello, what algo do you use, when you want to find the dict values from d, with members of l. Following example: d = {1:2,2:3,3:4,4:5,5:6,6:7,7:8,8:9,9:10} l = [7,8] found_dic_members = yourCode print found_dict_members [8,9] Thanks Alexander --

Re: Howto find dict members from a list of keys

2007-03-08 Thread Alexander Eisenhuth
Yes it was the silly on-liner ... it was a bit ago I used it last time ... thanks Gabriel Genellina schrieb: En Thu, 08 Mar 2007 05:37:48 -0300, Steven D'Aprano [EMAIL PROTECTED] escribió: On Thu, 08 Mar 2007 05:26:22 -0300, Gabriel Genellina wrote: found_dic_members = [d[key] for key in

Re: Howto pass exceptions between threads

2007-03-06 Thread Alexander Eisenhuth
John Nagle schrieb: Alexander Eisenhuth wrote: Hallo Alltogether, I've searched in this mailing list, but it seems to me that there is no general approach to pass exceptions from one thread to another. Very few languages have that. Actually, it could be made to work for Python

Howto pass exceptions between threads

2007-03-05 Thread Alexander Eisenhuth
Hallo Alltogether, I've searched in this mailing list, but it seems to me that there is no general approach to pass exceptions from one thread to another. I think most application do a unique way of handling unhandled exceptions, at least they (should) try to log them. The following

What is bad with Relative imports

2007-02-23 Thread Alexander Eisenhuth
Hi, PyLint says that Relative imports ... are worth to be warned . And I ask myself why? - Example directory structure - Sound/ Top-level package __init__.py Initialize the sound package Utils/

Build Python 2.5 wit VC6.0 ?

2007-02-02 Thread Alexander Eisenhuth
Hi everybody, does somebody have experience in building with VC6.0. On my first try there where missing C-Modules. Is that true. VC6.0 is not supported? Thanks a lot. Regards Alexander PC: What Python version supports VC6.0? -- http://mail.python.org/mailman/listinfo/python-list

Heap problems in Mulithreaded Python extension

2007-02-01 Thread Alexander Eisenhuth
Hi, I'm near the ground and need help. I'm building a multithreaded extension with boost.python. python extension - import extension extension.init() -PyEval_InitThreads(); setup 3 threads

Re: Heap problems in Mulithreaded Python extension

2007-02-01 Thread Alexander Eisenhuth
ok, once more my scheme python extension - import extension extension.init() -PyEval_InitThreads(); setup 3 threads (pthreads) and do a lot of things, but no python api

Heap cleanup in python extension

2006-11-15 Thread Alexander Eisenhuth
Hello Together, Shortly what I'm doing: - Extending python with boost.pthon extension - Using python C-Api for datatypes in the extension - extension has a thread (that can be stopped/started) - thread started: extension updates a dict (given as parameter to the extension) every 20 ms - the

Looking for assignement operator

2006-10-17 Thread Alexander Eisenhuth
Hello, is there a assignement operator, that i can overwrite? class MyInt: def __init__(self, val): assert(isinstance(val, int)) self._val = val a = MyInt(10) # Here i need to overwrite the assignement operator a = 12 Thanks Alexander --

Re: Looking for assignement operator

2006-10-17 Thread Alexander Eisenhuth
Wow, thanks a lot for your quick answers. That assignement is no operator, but a statemant is a pity, but indeed I came foward with overwritten methods for numeric types Regards Alexander -- http://mail.python.org/mailman/listinfo/python-list

dynamic creation of global Identifier

2006-10-11 Thread Alexander Eisenhuth
Hello alltogether, I've a little problem in creating a new identifier in the global namespace. The following code creates a as local var in the namespace of init() class A: def __init__(self, v): print ctr of, self.__class__, with, v self._v = v def

Re: COM makepy problem

2005-08-04 Thread Alexander Eisenhuth
James Kew schrieb: Alexander Eisenhuth [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] ActivePython 2.4.1 Windows XP I write a COM Server in VC++ 6.0 using ATL. So far so good. While I develop I got sometimes strange behaviour with makepy utility. Today again. :-( SyntaxError

COM makepy problem

2005-08-03 Thread Alexander Eisenhuth
Hello together, My system: ActivePython 2.4.1 Windows XP I write a COM Server in VC++ 6.0 using ATL. So far so good. While I develop I got sometimes strange behaviour with makepy utility. Today again. :-( What I do on the python (COM client) side. 1) Register COM server 2) Use COM makepy

Howto access a enumeration in a COM TypeLib

2005-06-21 Thread Alexander Eisenhuth
Hello alltogether, I hope somebody can help me in that case. I bet I have overseen s.th.. I have a VC++ IDispatch Com-Server (ATL) and include for error handling issues a enumeration in the IDL-File. [...] enum PROG_ERROR { P_OK = 0, P_ERR_01 = 1, P_ERR_02 = 2,

Re: Howto access a enumeration in a COM TypeLib

2005-06-21 Thread Alexander Eisenhuth
Thanks, thats it. Konstantin Veretennicov schrieb: import myserver print myserver.constants. P_OK 0 Maybe you can access constants without makepy, I don't know. - kv -- http://mail.python.org/mailman/listinfo/python-list

Re: Howto debug c++ (SWIG) extension under Windows

2005-04-27 Thread Alexander Eisenhuth
Miki Tebeka schrieb: Hello Alexander, I can't figure out howto debug my c++ extension. If i compile it as release version, I've of course no chance to set a breakpoint. This is not true. You *can* set breakpoints in release mode, make sure to add debug information to your release build so you'll

Nice documentation Python / SWIG / C++

2005-04-25 Thread Alexander Eisenhuth
Hi alltogether, I found a nice and useful article for extenting python with C++ using SWIG. It describe from the scratch especially for Windows. Maybe this can be included somewhere on www.python.org. Here is the link: http://www.geocities.com/foetsch/python/extending_python.htm Alexander

win32 COM and data types / direction

2005-03-04 Thread Alexander Eisenhuth
Hello everybody, i wonder how the win32 COM extension handles different C-int types (short, int, long). Another question for me is weather the out-direction of parameter is supported out of the box ? To clarify look at the methode FunWithTwoInts