[issue1796] ctypes should allow a tuple when an Array is expected

2008-01-14 Thread Thomas Heller
Thomas Heller added the comment: Corrected the patch to NOT accept None. Added file: http://bugs.python.org/file9163/ctypes-array-3.patch __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1796

[issue1798] Add ctypes calling convention that allows safe access of errno

2008-01-12 Thread Thomas Heller
Thomas Heller added the comment: But this thread-local attribute on the function seems bizarre to me. I would prefer another way to get the errno. I can see two alternatives: - the function returns a tuple (normalresult, errno) on each call. - when errno is not zero, EnvironmentError

[issue1793] ctypes.util.find_msvcrt() function

2008-01-11 Thread Thomas Heller
New submission from Thomas Heller: I'm uploading this patch for discussion, in case someone cares. This code (for Windows) adds a function ctypes.util.find_msvcrt(). This function returns the filename of the MSVC runtime library that the current Python executable uses. If calling functions

[issue1797] ctypes NULL function pointers should have a False bool value.

2008-01-11 Thread Thomas Heller
New submission from Thomas Heller: ctypes NULL function pointers should have a False bool value. -- assignee: theller components: Extension Modules files: ctypes-funcptr.patch keywords: patch messages: 59744 nosy: theller severity: normal status: open title: ctypes NULL function

[issue1796] ctypes should allow a tuple when an Array is expected

2008-01-11 Thread Thomas Heller
New submission from Thomas Heller: Another ctypes patch for discussion, if someone cares. This patch allows to pass a tuple of the correct size, a ctypes pointer to the correct itemtype, or None to foreign functions that expect ctypes array instances. 'None' is passed as a NULL pointer

[issue1793] ctypes.util.find_msvcrt() function

2008-01-11 Thread Thomas Heller
Thomas Heller added the comment: The cross-platform function is ctypes.util.find_library, which is currently not very useful on Windows. This patch changes it so that, on Windows, find_library(c) or find_library(m) finds the MS C runtime lib which exposes functions the are typically in libc

[issue1797] ctypes function pointer enhancements

2008-01-11 Thread Thomas Heller
Thomas Heller added the comment: The patch will be extended ASAP so that 'None' is accepted by foreign functions where a function pointer (callback function) is expected. For consistency it should be possible to call the ctypes function prototype with None to create a NULL callback function

[issue1798] Add ctypes calling convention that allows safe access of errno

2008-01-11 Thread Thomas Heller
New submission from Thomas Heller: This patch adds new calling conventions to ctypes foreign functions by passing 'errno=True' or 'GetLastError=True' to the CDLL or WinDLL constructor. If CDLL(..., errno=True) or WinDLL(..., errno=True) is used, the function objects available in the CDLL

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

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

[issue1642] segfault when deleting value member in ctypes types

2007-12-18 Thread Thomas Heller
Thomas Heller added the comment: Fixed in rev. 59549 (trunk) and rev. 59550 (release25-maint). Thanks. -- resolution: - fixed status: open - closed __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1642

[issue1597] running test_ctypes 25 times in a row causes it to fail

2007-12-12 Thread Thomas Heller
Thomas Heller added the comment: Guido van Rossum schrieb: Thanks! (I agree with Eric Smith that this is mysterious for the innocent bystander.) I have added a comment. Also, what about the -33/+33 leaks? I suppose these are harmless, but it would be better if the test reliably didn't

[issue1557] import distutils.msvccompiler hangs when the environment is too large

2007-12-05 Thread Thomas Heller
New submission from Thomas Heller: 'Python -c import distutils.msvccompiler' hangs when the environment is too large. This is because in Lib\distutils\msvc9compiler.py, line 258, popen.wait() does not return because the subprocess does not terminate (probably because the stdout buffersize

[issue1506] func alloca inside ctypes lib needs #include alloca.h on solaris

2007-11-29 Thread Thomas Heller
Thomas Heller added the comment: Greg Couch added the comment: Turns out callproc.c forgot to include ffi_common.h after ffi.h which conditionally includes alloca.h. So it's a one-line fix. This would not work. ffi_common.h is a file private to libffi; when Python is configured to use

[issue1505] Changes to PyMethod_New breaks ctypes on Windows

2007-11-27 Thread Thomas Heller
Thomas Heller added the comment: Christian Heimes schrieb: New submission from Christian Heimes: The problem is in _ctypes.c:create_comerror() around line 4620. The code tries to populate a dict with methods and finally pass them to PyErr_NewException(_ctypes.COMError, NULL, dict); I

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; I'm using Python 2.4

[issue1378] fromfd() and dup() for _socket on WIndows

2007-11-14 Thread Thomas Heller
Thomas Heller added the comment: Christian Heimes schrieb: Neal, Thomas, what do you think about the patch? Your knowledge of the Windows API is greater than mine. Is the duplicate_socket() function ok? I don't want to apply a patch I don't fully understand. +#ifdef MS_WINDOWS

[issue1406] Use widechar api for os.environ

2007-11-08 Thread Thomas Heller
New submission from Thomas Heller: This patch uses the windows widechar apis for os.environ. In this way, environment variables that use umlauts can be accessed. -- components: Interpreter Core, Windows files: posixmodule.c.diff keywords: patch, py3k messages: 57265 nosy: theller

[issue1406] Use widechar api for os.environ

2007-11-08 Thread Thomas Heller
Thomas Heller added the comment: Committed as rev 58916. The getpath.c, sys.path, and sys.argv issues is much more difficult to fix IMO. If you write a testcase for THIS issue (os.environ), I'll start thinking on them. No promises, though. -- assignee: - theller resolution: accepted

[issue1388] py3k-pep3137: possible ref leak in ctypes

2007-11-05 Thread Thomas Heller
Thomas Heller added the comment: ./python Lib/test/regrtest.py -R:: test_ctypes does not report a leak, so I think there is no leak. __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1388

[issue1388] py3k-pep3137: possible ref leak in ctypes

2007-11-05 Thread Thomas Heller
Thomas Heller added the comment: $ ./python Lib/test/regrtest.py -R:: test_ctypes test_ctypes beginning 9 repetitions 123456789 . test_ctypes leaked [-33, 0, 0, 0] references, sum=-33 1 test OK. [101762 refs] Yes, I think this is ok. __ Tracker

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

[issue1292] libffi needs an update to support mips64, arm and armeabi on linux

2007-11-02 Thread Thomas Heller
Thomas Heller added the comment: I have now made --with-system-ffi default to yes for Linux/alpha*, Linux/arm*, Linux/ppc*, and Linux/s390* machines. If you think it is needed for mips machines also please add this - there's no buildbot where I can check the result

[issue1292] libffi needs an update to support mips64, arm and armeabi on linux

2007-10-31 Thread Thomas Heller
Thomas Heller added the comment: In the branches_ctypes-branch I hacked setup.py to always use an installed libffi if one is found. Then I triggered the trunk buildbots which failed or crashed before in some c_longdouble tests; the tests worked ok on them (ppc Debian unstable, and S-390 Debian

[issue1292] libffi needs an update to support mips64, arm and armeabi on linux

2007-10-31 Thread Thomas Heller
Thomas Heller added the comment: I meant branches/ctypes_branch, of course. __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1292 __ ___ Python-bugs-list mailing list Unsubscribe

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 Python

[issue1324] r58034 breaks building _ctypes with the upstream libffi.

2007-10-25 Thread Thomas Heller
Thomas Heller added the comment: Maybe I should give up the idea to define the ffi_type_... types myself. Committed as rev 58655. Thanks. -- resolution: - accepted status: open - closed __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1324

[issue1292] libffi needs an update to support mips64, arm and armeabi on linux

2007-10-25 Thread Thomas Heller
Thomas Heller added the comment: I'm unsure how to proceed with this. Replacing the copy of libffi in the ctypes sources - I'm very afraid to do that. It has it's own configure system, written by someone else. Then it has several changes from various people for Python, which would

[issue1319] py3k: fixes for test_ctypes

2007-10-24 Thread Thomas Heller
Thomas Heller added the comment: Guido van Rossum schrieb: Looks good to me. I can check it in if Thomas is okay with that (or if he remains silent long enough :-). Looks good to me too. Please check it in if you have time ;-) __ Tracker [EMAIL PROTECTED

[issue1319] py3k: fixes for test_ctypes

2007-10-24 Thread Thomas Heller
Thomas Heller added the comment: Here's the bugfix - is it correct? Added file: http://bugs.python.org/file8603/_ctypes.patch __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1319 __Index: Modules/_ctypes/_ctypes.c

[issue1319] py3k: fixes for test_ctypes

2007-10-24 Thread Thomas Heller
Thomas Heller added the comment: Committed as rev 58642. __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1319 __ ___ Python-bugs-list mailing list Unsubscribe: http

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

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 that

[issue1295] logging records cache the result of formatException()

2007-10-18 Thread Thomas Heller
New submission from Thomas Heller: I needed two logging handlers in my application, one notifiying the user of errors, the other writing errors to a logfile. So I created a custom subclass of logging.Formatter and redefined the formatException() method that returned a summary of the exception

[issue1295] logging records cache the result of formatException()

2007-10-18 Thread Thomas Heller
Thomas Heller added the comment: This is tough. On the one hand you are right that different classes that have different formatException() methods aren't treated correctly; on the other hand I think the caching is important for other cases where there are multiple loggers all using

[issue1295] logging records cache the result of formatException()

2007-10-18 Thread Thomas Heller
Thomas Heller added the comment: I think that a warning or an example in the docs would be nice, but I have no time to make a patch for that. -- resolution: - wont fix status: open - closed __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1295

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: Keeping track of subclasses and instances?

2007-10-11 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, Oct 18

[issue1203] ctypes doesn't work on Mac with --disable-toolbox-glue

2007-10-11 Thread Thomas Heller
Thomas Heller added the comment: IMO os.uname() is preferable. Committed as SVN rev 58415 in trunk. Thanks. -- assignee: - theller resolution: - accepted status: open - closed __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1203

Re: Where's the Starship's crew?

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

[issue1203] ctypes doesn't work on Mac with --disable-toolbox-glue

2007-09-25 Thread Thomas Heller
Thomas Heller added the comment: Would you like to prepare a patch? I have no idea how the return values of gestalt.gestalt(sysv) and platform.release() relate to each other... -- nosy: +theller __ Tracker [EMAIL PROTECTED] http://bugs.python.org

[issue1203] ctypes doesn't work on Mac with --disable-toolbox-glue

2007-09-25 Thread Thomas Heller
Thomas Heller added the comment: On the mac where I have access to platform.release() returns the string '8.10.0'. gestalt.gestalt(sysv) returns 0x1049. Your patch does not look correct to me. __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1203

[issue1203] ctypes doesn't work on Mac with --disable-toolbox-glue

2007-09-25 Thread Thomas Heller
Thomas Heller added the comment: This patch looks better. However, the 'os.uname()' function seems to return the information that we need; so I updated the patch to use this instead. Can you please proofread it (osx.patch) ? __ Tracker [EMAIL PROTECTED] http

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(sys.argv[1:]), then the double

[issue1777530] ctypes on Solaris

2007-09-12 Thread Thomas Heller
Thomas Heller added the comment: Can someone please test the patch and report back? -- Thanks _ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1777530 _ ___ Python-bugs

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 = My Program ver

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 also

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 dictionary, like so:

[issue1777530] ctypes on Solaris

2007-09-05 Thread Thomas Heller
Thomas Heller added the comment: Martin, here is a patch (solaris-2.patch), hopefully according to your comments. _ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1777530 _Index: util.py

[issue1777530] ctypes on Solaris

2007-09-03 Thread Thomas Heller
Thomas Heller added the comment: This is an experimental patch (solaris.patch). Can you please proofread it and try it out on the solaris machine? _ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1777530 _Index

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:

[issue1039] Asssertion in Windows debug build

2007-08-30 Thread Thomas Heller
Thomas Heller added the comment: Applied in rev. 57731. -- resolution: accepted - fixed status: open - closed __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1039

[issue1617699] slice-object support for ctypes Pointer/Array

2007-08-30 Thread Thomas Heller
Thomas Heller added the comment: Set to accepted. As pointed out in private email, please apply it to the trunk. Your thoughts about the 'length' of pointers make sense, and are very similar to what I had in mind when I implemented pointer indexing. For indexing pointers, negative indices

[issue1617699] slice-object support for ctypes Pointer/Array

2007-08-30 Thread Thomas Heller
Changes by Thomas Heller: -- assignee: theller - twouters _ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1617699 _ ___ Python-bugs-list mailing list Unsubscribe

[issue1617699] slice-object support for ctypes Pointer/Array

2007-08-30 Thread Thomas Heller
Thomas Heller added the comment: Yes. But looking at your examples I think it would be better to forbid missing indices completely instead of allowing them only where they clearly mean 0. Writing (and reading!) a 0 is faster than thinking about if a missing index is allowed or what it means

[issue1040] Unicode problem with TZ

2007-08-29 Thread Thomas Heller
Thomas Heller added the comment: IMO the very best would be to avoid as many conversions as possible by using the wide apis on Windows. Not for _tzname maybe, but for env vars, sys.argv, sys.path, and so on. Not that I would have time to work

[issue1039] Asssertion in Windows debug build

2007-08-28 Thread Thomas Heller
New submission from Thomas Heller: In a windows debug build, an assertion is triggered when os.execvpe is called with an empty argument list: self.assertRaises(OSError, os.execvpe, 'no such app-', [], None) The same problem is present in the trunk version. Attached is a patch that fixes

[issue1043] test_builtin failure on Windows

2007-08-28 Thread Thomas Heller
New submission from Thomas Heller: test test_builtin failed -- Traceback (most recent call last): File c:\svn\py3k\lib\test\test_builtin.py, line 1473, in test_round self.assertEqual(round(1e20), 1e20) AssertionError: 0 != 1e+020 -- components: Windows messages: 55355 nosy

[issue1042] test_glob fails with UnicodeDecodeError

2007-08-28 Thread Thomas Heller
New submission from Thomas Heller: Unicode errors in various tests - not only in test_glob: test_glob test test_glob failed -- Traceback (most recent call last): File c:\svn\py3k\lib\test\test_glob.py, line 87, in test_glob_directory_names eq(self.glob('*', '*a'), []) File c

[issue1040] Unicode problem with TZ

2007-08-28 Thread Thomas Heller
Thomas Heller added the comment: BTW, setting the environment variable TZ to, say, 'GMT' makes the problem go away. __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1040

[issue1040] Unicode problem with TZ

2007-08-28 Thread Thomas Heller
New submission from Thomas Heller: In my german version of winXP SP2, python3 cannot import the time module: c:\svn\py3k\PCbuildpython_d Python 3.0x (py3k:57600M, Aug 28 2007, 07:58:23) [MSC v.1310 32 bit (Intel)] on win32 Type help, copyright, credits or license for more information. import

[issue1041] io.py problems on Windows

2007-08-28 Thread Thomas Heller
New submission from Thomas Heller: Running the PCBuild\rt.bat script fails when it compares the expected output with the actual output. Some inspection shows that the comparison fails because there are '\n' linefeeds in the expected and '\n\r' linefeeds in the actual output: c:\svn\py3k

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 have

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 installed. I'm

Re: renaming an open file in nt like unix?

2007-07-13 Thread Thomas Heller
[EMAIL PROTECTED] schrieb: Hi. I'm writing an archival system which I'd like to be portable to Windows. The system relies on the property of Unix which allows a process to keep a file open even if another process renames it while it is open. Neither process sees any anomaly or error.

Re: The best platform and editor for Python

2007-07-05 Thread Thomas Heller
QOTW? Gregor Horvath schrieb: That's a property of open source projects. Features nobody really needs are not implemented. Gregor -- http://mail.python.org/mailman/listinfo/python-list

Re: Re-raising exceptions with modified message

2007-07-05 Thread Thomas Heller
Christoph Zwerschke schrieb: What is the best way to re-raise any exception with a message supplemented with additional information (e.g. line number in a template)? I have the impression that you do NOT want to change the exceptions, instead you want to print the traceback in a customized

Re: Interest in a one-day business conference for Python, Zope and Plone companies ?

2007-07-04 Thread Thomas Heller
eGenix Team: M.-A. Lemburg schrieb: Hello, eGenix is looking into organizing a one day conference specifically for companies doing business with Python, Zope and Plone. The conference will likely be held in or close to Düsseldorf, Germany, which is lively medium-sized city, with good

Re: 16bit hash

2007-06-27 Thread Thomas Heller
Robin Becker schrieb: Josiah Carlson wrote: Robin Becker wrote: Is the any way to get an efficient 16bit hash in python? hash(obj)65535 - Josiah yes I thought of that, but cannot figure out if the internal hash really distributes the bits evenly. Particularly since it seems to treat

Re: assert annoyance

2007-06-22 Thread Thomas Heller
Paul Rubin schrieb: So I have some assert statements in my code to verify the absence of some impossible conditions. They were useful in debugging and of course I left them in place for real runs of the program. Umpteen hours into a run, an assertion failed, and of course since failure was

Re: very simple shared dll with ctypes

2007-06-19 Thread Thomas Heller
mclaugb schrieb: I have created a simple windows small_dll.dll exporting a function that does a computation using C and C++ classes which i wish to call from Python. I have read lots of ctypes documentation but I still dont quite understand how to call the function. As a test, I have

Re: ctypes pointer

2007-06-19 Thread Thomas Heller
mclaugb schrieb: I have a simple function void adder(double a, double b, double *c){ *c = a+b; } i have created a shared dll -- small_dll4.dll of it using visual studio. now i wish to call it from python. to do so, i have done the following: libx = cdll(small_dll4.dll, RTLD_GLOBAL)

Re: Optimizing constants in loops

2007-06-13 Thread Thomas Heller
Michael Hoffman schrieb: The peephole optimizer now takes things like if 0: do_stuff() and optimizes them away, and optimizes away the conditional in if 1:. What if I had a function like this? def func(debug=False): for index in xrange(100): if debug:

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

Re: FAQ: how to vary the byte offset of a field of a ctypes.Structure

2007-05-31 Thread Thomas Heller
[EMAIL PROTECTED] schrieb: How do I vary the byte offset of a field of a ctypes.Structure? How do I use the dynamic nature of Python, and (re-)define the data type after the required size is already known, on a case by case basis? \\\ For example, suppose sometimes I receive the value

ctypes-1.0.2 for 64-bit Windows

2007-05-16 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

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 thousands

ANN: ctypes 1.0.2 released

2007-05-15 Thread Thomas Heller
ctypes 1.0.2 released - May 15, 2007 Overview ctypes is an advanced ffi (Foreign Function Interface) package for Python 2.3 and higher. ctypes allows to call functions exposed from dlls/shared libraries and has extensive facilities to create,

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

Re: ctypes: Problems using Windows-DLL from VB example code

2007-05-09 Thread Thomas Heller
Noralf Trønnes schrieb: Hi I'm trying to use a DLL from Python using ctypes. The call to dso_lib.capture_hold_chk() does return 232. So it seem to work. The call to dso_lib.port_init(init_data) gives: WindowsError: exception: access violation reading 0x0006 Any suggestions? Have

Re: ctypes: Problems using Windows-DLL from VB example code

2007-05-09 Thread Thomas Heller
Have you tried to pass the structure by reference? dso_lib.port_init(byref(init_data)) That gives me another exeption: print dso_lib.port_init(byref(init_data)) ValueError: Procedure called with not enough arguments (4 bytes missing) or wrong calling convention Please try using

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 grin. 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 COM server

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

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 Python

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 that fully meets

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 Windows/AMD64.

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

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 test.exe

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

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

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 string, line 8, in module File E:\Documents\mich\job\abs\backup_skript\buildbackup\out1.pyz/ email, lin

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

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 implementations there is also this: http://mail.python.org

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 class

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 announce partial 1.0; a module to implement partial classes in Python. It is available from http

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

<    1   2   3   4   5   6   7   8   >