From: <Ric...@t-...> - 2006-10-27 17:23:44
|
Hello, I have noticed that not only myself but a number of other people have been having problems with a spurious "syntax error" problem whilst using typelibs. The generated program under gen_py is supposed to have syntax errors but none can be found. Since I had the problem may I offer one possible explanation. The generated file begins as follows: # -*- coding: mbcs -*- # Created by makepy.py version 0.4.95 # By python version 2.4.1 (#65, Mar 30 2005, 09:33:37) [MSC v.1310 32 bit (Intel)] # From type library '{D7D6E071-DCCD-11D0-AA4B-0060970DEBAE}' # On Fri Oct 27 16:25:07 2006 """Microsoft Message Queue 2.0 Object Library""" makepy_version = '0.4.95' python_version = 0x20401f0. . . Since the program was generated on a german system and contains Umlauts as in: class IMSMQCoordinatedTransactionDispenser(DispatchBaseClass): """Schnittstelle zur Beschreibung eines DTC-Transaktionsverteilers. Unterstützt das Erstellen neuer DTC-Transaktionen.""" but has an encoding mbcs I tried a long shot and changed the encoding line to: # -*- coding: iso-8859-1 -*- Lo and behold the syntax error disappeared and everything worked. I presume that characters are being swallowed and if it happens at an unfortunate position then things go wrong. I suspect that iso-8859-1 is not a general solution for everybody, but at least it is a workaround. Greetings, Richard Sharp -- Richard Sharp Tel: 04533-791588 Steinhöfer Str. 10 Mobil: 0171-8824244 23858 Reinfeld Mail: rb...@gm... |
From: Thomas H. <th...@ct...> - 2006-10-27 18:13:01
|
Richard Sharp schrieb: > Hello, > I have noticed that not only myself but a number of other people have > been having problems with a spurious "syntax error" problem whilst using > typelibs. The generated program under gen_py is supposed to have syntax > errors but none can be found. > > Since I had the problem may I offer one possible explanation. > > The generated file begins as follows: > > # -*- coding: mbcs -*- > # Created by makepy.py version 0.4.95 > # By python version 2.4.1 (#65, Mar 30 2005, 09:33:37) [MSC v.1310 32 > bit (Intel)] > # From type library '{D7D6E071-DCCD-11D0-AA4B-0060970DEBAE}' > # On Fri Oct 27 16:25:07 2006 > """Microsoft Message Queue 2.0 Object Library""" > makepy_version = '0.4.95' > python_version = 0x20401f0. > . Didn't the early Python 2.4 versions (it seems you use 2.4.1, while we are at 2.4.4 currently) have some problems or bugs, and weren't these fixed in later versions? (I'm not sure I remember this exactly, maybe the problem was in makepy or pywin32, not in Python). Thomas |