I need to call some Windows APIs. Is the only way to download ctypes or
the win32 interfaces? Is there any plan to get ctypes batteries into
the standard Python build? 18 2353
Paul Watson wrote: I need to call some Windows APIs. Is the only way to download ctypes or the win32 interfaces?
That depends on the specific win32 interface you want to call.
Typically, the answer is "yes".
Is there any plan to get ctypes batteries into the standard Python build?
I don't have such a plan. To my knowledge, ctypes has never been
contributed to Python, either, so its author apparently has no plan,
either.
Regards,
Martin
Paul Watson: Is there any plan to get ctypes batteries into the standard Python build?
It is unlikely that ctypes will be included in the standard Python
build as it allows unsafe memory access making it much easier to crash
Python.
Neil
"Martin v. Löwis" <ma****@v.loewis.de> writes: To my knowledge, ctypes has never been contributed to Python, either, so its author apparently has no plan, either.
Has anyone from Python.org asked him or her?
Paul Rubin wrote: To my knowledge, ctypes has never been contributed to Python, either, so its author apparently has no plan, either.
Has anyone from Python.org asked him or her?
I can't answer that question. I haven't (and I personally
share Neil Hodgson's reservation wrt. to the possibility
of crashing the interpreter).
Regards,
Martin
Neil Hodgson wrote: Paul Watson:
Is there any plan to get ctypes batteries into the standard Python build?
It is unlikely that ctypes will be included in the standard Python build as it allows unsafe memory access making it much easier to crash Python.
Does extending Python with any C/C++ function not do the same thing?
Martin v. Löwis wrote: Paul Watson wrote:
I need to call some Windows APIs. Is the only way to download ctypes or the win32 interfaces?
That depends on the specific win32 interface you want to call. Typically, the answer is "yes".
I have used _winreg and I see winsound in the doc.
I need to call GetVersionInfo() and handle VERSIONINFO information. I
thought that distutils might have something, but I do not see it yet.
Any suggestions?
Paul Watson: Neil Hodgson wrote: It is unlikely that ctypes will be included in the standard Python build as it allows unsafe memory access making it much easier to crash Python. Does extending Python with any C/C++ function not do the same thing?
No. It is the responsibility of the extension author to ensure that
there is no possibility of crashing Python. With ctypes, you have a
generic mechanism that enables Python code to cause a crash.
Neil
Neil Hodgson <ny*****************@gmail.com> writes: No. It is the responsibility of the extension author to ensure that there is no possibility of crashing Python. With ctypes, you have a generic mechanism that enables Python code to cause a crash. http://docs.python.org/lib/module-dl.html
would seem to also do that.
Paul Watson wrote: I need to call GetVersionInfo() and handle VERSIONINFO information. I thought that distutils might have something, but I do not see it yet. Any suggestions?
You could write this specific API in VB, and then run cscript.exe in
a pipe; or you could write a wrapper module just for that specific
API (in case PythonWin is too large for you).
Regards,
Martin
Paul Rubin wrote: http://docs.python.org/lib/module-dl.html would seem to also do that.
That's correct. It has the same (unhealable) flaw.
No surprise, though: it provides the same functionality.
Regards,
Martin
Jean-Paul Calderone wrote: I could probably dig up a few more, if you want. So what's ctypes on top of this?
another one:
cfbolz@gauss:~$ python
Python 2.4.2 (#2, Sep 30 2005, 21:19:01)
[GCC 4.0.2 20050808 (prerelease) (Ubuntu 4.0.1-4ubuntu8)] on linux2
Type "help", "copyright", "credits" or "license" for more information. import weakref ref = None class Target:
.... def __del__(self):
.... global ref
.... ref = weakref.ref(self)
.... def g():
.... w = Target()
.... w = None
.... print ref()
.... g()
Segmentation fault
There are dozends of segfaults in Python indeed.
Cheers,
Carl Friedrich Bolz
Martin v. Löwis wrote: Paul Watson wrote:
I need to call GetVersionInfo() and handle VERSIONINFO information. I thought that distutils might have something, but I do not see it yet. Any suggestions?
You could write this specific API in VB, and then run cscript.exe in a pipe; or you could write a wrapper module just for that specific API (in case PythonWin is too large for you).
I cannot find any way to get to GetVersionInfo in VBScript (cscript).
If so, this appears to leave me with no choice but to produce a Windows
executable, whether a .exe or C code wrapped from Python. Right?
Paul Watson wrote: I cannot find any way to get to GetVersionInfo in VBScript (cscript).
Well, in VB6, you have ctypes. So you can call any API function you
like to.
For one implementation, see http://www.andreavb.com/tip030020.html
Regards,
Martin
"=?UTF-8?B?Ik1hcnRpbiB2LiBMw7Z3aXMi?=" <ma****@v.loewis.de> writes: Paul Watson wrote: I need to call some Windows APIs. Is the only way to download ctypes or the win32 interfaces?
That depends on the specific win32 interface you want to call. Typically, the answer is "yes".
Is there any plan to get ctypes batteries into the standard Python build?
I don't have such a plan. To my knowledge, ctypes has never been contributed to Python, either, so its author apparently has no plan, either.
As the author, I would be happy to see ctypes included with the standard
Python build.
Thomas
Paul Watson: I cannot find any way to get to GetVersionInfo in VBScript (cscript).
Set objFSO = CreateObject("Scripting.FileSystemObject")
Wscript.Echo objFSO.GetFileVersion("c:\bin\SciLexer.dll")
Neil
Neil Hodgson wrote: Paul Watson:
I cannot find any way to get to GetVersionInfo in VBScript (cscript).
Set objFSO = CreateObject("Scripting.FileSystemObject") Wscript.Echo objFSO.GetFileVersion("c:\bin\SciLexer.dll")
Many thanks. Just what I needed. (Short of ctypes.) Thank you for
tolerating a VBScript question here.
Paul Watson wrote:
..
..
.. I need to call GetVersionInfo() and handle VERSIONINFO information. I thought that distutils might have something, but I do not see it yet. Any suggestions?
This information is provided with sys.getwindowsversion().
Sorry, the previous post is wrong. I mixed the function names. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Todd Gardner |
last post by:
Hello all,
Pardon my ignorance here. I would like to talk to someone that has
had success in calling ddls in Windows NT/2000/XP.
I am wondering where to dload any of these packages? Google...
|
by: Brad Tilley |
last post by:
Is it possible to write a file open, then read program in C and then
call the C program from a Python script like this:
for root, files, dirs in os.walk(path)
for f in files:
try:...
|
by: Gerald Klix |
last post by:
I read the whol email thread carefully and could not find any sentence by
Guido, which states that he does not accept ctypes for the standard library.
He just declined to rewrite winreg. Did I miss...
|
by: Podi |
last post by:
I have ctypes version 0.9.6 and Python 2.4.2 running on Windows XP
Professional.
When I tried to use some functions in the Advapi32.dll, some functions
are available and some are not. Is this a...
|
by: chaosquant |
last post by:
I'm kind of beginner in Python, so I must ask what are probably silly
questions.
Here is my problem:
I have a static library say, a file library.lib, which can be linked to
C or C++ programs....
|
by: mirandacascade |
last post by:
I am prompted to make these inquiries after seeing the following link
to ctypes:
http://docs.python.org/lib/module-ctypes.html
in which ctypes is described as a foreign function library.
...
|
by: sjdevnull |
last post by:
Hey,
I'm trying to wrap GNU readline with ctypes (the Python readline
library doesn't support the callback interface), but I can't figure out
how to set values to a variable inside the library. ...
|
by: Mangabasi |
last post by:
Howdy,
I have been trying to call the following Fortran function from Python
(using Windows XP, Compaq Fortran and Python 2.4). I tried F2Py,
Pyfort and calldll with no success.
I think I...
|
by: moreati |
last post by:
Recently I discovered the re module doesn't support POSIX character
classes:
Python 2.5.2 (r252:60911, Apr 21 2008, 11:12:42)
on linux2
Type "help", "copyright", "credits" or "license" for...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
| |