Re: Win32api problems
On 10/22/19, Albert-Jan Roskam wrote: > On 22 Oct 2019 11:23, GerritM wrote: > >> ImportError: DLL load failed: The specified > procedure could not be >> found. Many of the PyWin32 extensions depend on pywintypesXX.dll, and some depend on pythoncomXX.dll. There's a post-installation script that copies them either to the System32 directory or to Python's installation directory (i.e. the location of python.exe). The latter is better if you're doing this manually. There's no reason to pollute System32. If you're developing a service, pythonerservice.exe depends on pythonXX.dll, so copy pythonservice.exe to Python's installation directory as well if pythonXX.dll is located there instead of in System32. You can use relative symlinks instead of copies if Python is installed on a file system that supports reparse points, such as the system volume (NTFS). For example: >>> print(os.readlink(os.path.join(sys.prefix, 'pywintypes37.dll'))) Lib\site-packages\pywin32_system32\pywintypes37.dll Then if you upgrade PyWin32, you won't have to remember to replace the old copies. > I've had the same error before and I solved it by adding the location where > the win32 dlls live to PATH. Maybe PATH gets messed up during the > installation of something. In Python 3.8, PATH isn't used when loading extension modules. It's also not used when loading DLLs via ctypes. In many cases this change isn't an issue since dependendent DLLs are in the same directory as the extension module. If not, add the directory that has the dependencies via os.add_dll_directory(). -- https://mail.python.org/mailman/listinfo/python-list
Re: Win32api problems
Am 22.10.2019 um 19:24 schrieb Terry Reedy: ... Is there a win32 list where people might have more knowledge of such? There is: python-wi...@python.org https://mail.python.org/mailman/listinfo/python-win32 If you prefer Gmane: news://news.gmane.org/gmane.comp.python.windows HTH -- https://mail.python.org/mailman/listinfo/python-list
Re: Win32api problems
On 2019-10-22 17:31, Albert-Jan Roskam wrote: On 22 Oct 2019 11:23, GerritM wrote: ImportError: DLL load failed: The specified > procedure could not be found. I've had the same error before and I solved it by adding the location where the win32 dlls live to PATH. Maybe PATH gets messed up during the installation of something. I recently had a problem when I tried win32 on a newly-installed Python 3.8 and I couldn't import win32clipboard. The solution in that case was to copy pywintypes38.dll and pythoncom38.dll from site-packages/pywin32_system32 into site-packages/win32. (Note: those names had "38" for Python 3.8.) -- https://mail.python.org/mailman/listinfo/python-list
Re: Win32api problems
On 10/22/2019 11:42 AM, GerritM wrote: On Tuesday, October 22, 2019 at 12:09:46 PM UTC+2, Terry Reedy wrote: On 10/22/2019 5:23 AM, GerritM wrote: <...snip...> Install 1 at a time and try your normal scripts? Starting from a state of ignorance about interactions between Win32 and other modules, this is what I would do. I found on Internet many people struggling with Win32 over the years. It served me without problems for decades. So, I was wondering, whether somewhere in the growth of modules and options a weak spot is appearing... Is there a win32 list where people might have more knowledge of such? -- Terry Jan Reedy -- https://mail.python.org/mailman/listinfo/python-list
Re: Win32api problems
On 22 Oct 2019 11:23, GerritM wrote: > ImportError: DLL load failed: The specified > procedure could not be found. I've had the same error before and I solved it by adding the location where the win32 dlls live to PATH. Maybe PATH gets messed up during the installation of something. -- https://mail.python.org/mailman/listinfo/python-list
Re: Win32api problems
On Tuesday, October 22, 2019 at 12:09:46 PM UTC+2, Terry Reedy wrote: > On 10/22/2019 5:23 AM, GerritM wrote: <...snip...> > > Install 1 at a time and try your normal scripts? Or try them with 3.7. > > -- > Terry Jan Reedy I am working on the Python 2 to Python 3 transition. I found on Internet many people struggling with Win32 over the years. It served me without problems for decades. So, I was wondering, whether somewhere in the growth of modules and options a weak spot is appearing... Gerrit -- https://mail.python.org/mailman/listinfo/python-list
Re: Win32api problems
On 10/22/2019 5:23 AM, GerritM wrote: I recently installed IPython, Pandas, Altair, Jupyter, MatPlotLib, and Numpy on my Windows 10, Python27 installation to explore what it can do. All of those 5 packages either have or will stop supporting 2.x. See https://python3statement.org/. When I tried to run my normal scripts a few days later, I discovered that win32com and related modules like win32ami give problems: Traceback (most recent call last): File "D:\gaudi\src\PythonTools\generateDocumentsPdf.py", line 10, in from win32com.client.dynamic import Dispatch File "C:\Python27\lib\site-packages\win32com\__init__.py", line 5, in import win32api, sys, os ImportError: DLL load failed: The specified procedure could not be found. after trying out several tips on Internet, like copying dll and pyd files, I re-installed my entire ActiveState installation. Luckily it works again. However, question is what culprit of my initial list damaged the Python-win32 configuration? Install 1 at a time and try your normal scripts? Or try them with 3.7. -- Terry Jan Reedy -- https://mail.python.org/mailman/listinfo/python-list
Win32api problems
I recently installed IPython, Pandas, Altair, Jupyter, MatPlotLib, and Numpy on my Windows 10, Python27 installation to explore what it can do. When I tried to run my normal scripts a few days later, I discovered that win32com and related modules like win32ami give problems: Traceback (most recent call last): File "D:\gaudi\src\PythonTools\generateDocumentsPdf.py", line 10, in from win32com.client.dynamic import Dispatch File "C:\Python27\lib\site-packages\win32com\__init__.py", line 5, in import win32api, sys, os ImportError: DLL load failed: The specified procedure could not be found. after trying out several tips on Internet, like copying dll and pyd files, I re-installed my entire ActiveState installation. Luckily it works again. However, question is what culprit of my initial list damaged the Python-win32 configuration? Gerrit -- https://mail.python.org/mailman/listinfo/python-list
How to use win32api package to send to printer a file in memory
I have an Angular application that is communicating via websocket with a python app. Actually, I save the file in Angular, then I pass to the websocket the file path and I print it by win32api.ShellExecute. Anyway, I do not really need to save the file, so would be much better to send the content though the websocket and then then print it. Can anyone send me some code snippet to show: 1. Which is the best data structure to receive the file content via websocket (bytes array?) 2. How to invoke win32api.ShellExecute, or equivalent function, to print the content. Thank you -- https://mail.python.org/mailman/listinfo/python-list
how to simulate keydown and keyup events using win32api .
win32api.keybd_event(code,0,0,0) time.sleep(2) win32api.keybd_event(code,0,win32con.KEYEVENTF_KEYUP,0) the above code is simulating single click on button but not press Key Hold but i want to hold the until key up event is called eg: for key 'a' down it have to simulate key continous set until keyUp is called but not like "a" please specify any python API to simulate continues keyDown until it receives keyUp event -- https://mail.python.org/mailman/listinfo/python-list
Re: can't find win32api from embedded pyrun call
the problem was: ActivePython does not install debug libraries, so you must link with release libraries in your project. but if you run the debug version, you're linking against debug libraries which conflict with the ones linked to by python. "fixed" by running the release version. basically, it's not possible to debug with ActivePython due to ActiveState not including debug libs. grr -- https://mail.python.org/mailman/listinfo/python-list
Re: can't find win32api from embedded pyrun call
On 03/09/2013 21:50, David M. Cotter wrote: > I find i'm having this problem, but the solution you found isn't > quite specific enough for me to be able to follow it. > > I'm embedding Python27 in my app. I have users install > ActivePython27 in order to take advantage of python in my app, so the > python installation can't be touched as it's on a user's machine. > > When I attempt to do: >> import win32api > > i get this: >> Traceback (most recent call last): File "startup.py", line 5, in >> ImportError: DLL load failed: The specified module could >> not be found. You'll likely get more input from the guys on the python-win32 list. Most times I've come across this issue it's been because the pywin32 package (or the whole Python distribution if you're using ActiveState) was not installed as an administrator / elevated. I'm not sure I've ever fathomed why, and the investigation isn't helped by the import dance which the pywin32 code does. I don't remember solving it without a reinstall on the user's machine. TJG -- https://mail.python.org/mailman/listinfo/python-list
Re: can't find win32api from embedded pyrun call
note that when the script is called, i DO see this in the output window: > 'kJams 2 Debug.exe': Loaded 'C:\Python27\Lib\site-packages\win32\win32api.pyd' > 'kJams 2 Debug.exe': Loaded 'C:\Windows\SysWOW64\pywintypes27.dll' > 'kJams 2 Debug.exe': Unloaded > 'C:\Python27\Lib\site-packages\win32\win32api.pyd' > 'kJams 2 Debug.exe': Unloaded 'C:\Windows\SysWOW64\pywintypes27.dll' -- https://mail.python.org/mailman/listinfo/python-list
Re: can't find win32api from embedded pyrun call
I find i'm having this problem, but the solution you found isn't quite specific enough for me to be able to follow it. I'm embedding Python27 in my app. I have users install ActivePython27 in order to take advantage of python in my app, so the python installation can't be touched as it's on a user's machine. When I attempt to do: >import win32api i get this: >Traceback (most recent call last): > File "startup.py", line 5, in >ImportError: DLL load failed: The specified module could not be found. I someone suggested i manually load the dependent libraries in the correct order, like this: >import pywintypes >import pythoncom >import win32api but then i get this: >Traceback (most recent call last): > File "startup.py", line 3, in > File "C:\Python27\lib\site-packages\win32\lib\pywintypes.py", line 124, in > >__import_pywin32_system_module__("pywintypes", globals()) > File "C:\Python27\lib\site-packages\win32\lib\pywintypes.py", line 64, in > __import_pywin32_system_module__ >import _win32sysloader ImportError: DLL load failed: The specified module could not be found. the ultimate goal here is actually to do this: >from win32com.client.gencache import EnsureDispatch which currently yields: >Traceback (most recent call last): > File "startup.py", line 3, in > File "C:\Python27\lib\site-packages\win32com\__init__.py", line 5, in > >import win32api, sys, os >ImportError: DLL load failed: The specified module could not be found. So, if anyone has any idea, that would be super duper great. thanks so much! notes: my paths are definitely set correctly -- https://mail.python.org/mailman/listinfo/python-list
Re: win32api install problem
Gerry wrote: >I'm running Python 2.6 under XP. > >I've installed Windows 32 extensions for Python 2.6 version 1.4 >(pywin32-214.win32-py2.6.exe). > >But If I try to import win32api, I get: > > File "C:\python_projects\euler\driveletters.py", line 1, in >import win32api >ImportError: DLL load failed: The specified module could not be found. > >\Python26\Lib\site-packages has: > >03/23/2009 08:35 AM win32 >07/20/2009 09:08 AM win32com >02/18/2009 01:21 PM win32comext > >Can anyone offer a suggestion? It is very unusual that those three directories should have different creation dates. Normally, all three would have the same date and time, from whenever you ran the installer. I would suggest that you go into Add and Remove Programs, uninstall pywin32, and run the installer again. -- Tim Roberts, t...@probo.com Providenza & Boekelheide, Inc. -- http://mail.python.org/mailman/listinfo/python-list
Re: win32api install problem
MCIPERF wrote: On Jul 20, 9:57 am, Tim Golden wrote: Gerry wrote: I'm running Python 2.6 under XP. I've installed Windows 32 extensions for Python 2.6 version 1.4 (pywin32-214.win32-py2.6.exe). But If I try to import win32api, I get: File "C:\python_projects\euler\driveletters.py", line 1, in import win32api ImportError: DLL load failed: The specified module could not be found. Used to be you'd get this error if you installed as a non-admin user. Don't know if that's still an issue. Possibility? TJG Not a possibility (afaict) -- I am an administrator, according to the control panel. Not too many ideas, then, I'm afraid. Apart from the obvious -- uninstall and try again -- how about running Python with the -vv option: python -vv to get more information about what it's trying to get, and/or running sysinternal's Process Explorer at the same time to spot the DLL Dependencies. I have seen a (not too similar) problem when running TortoiseHg and the pywin32 extensions, since the shell import's TortoiseHg's version of various pywin32 DLLs before I try to import them myself for some other purpose, and the two versions clashed dramatically (crashed Explorer hard, I seem to remember). Just in case that rings any bells.. TJG -- http://mail.python.org/mailman/listinfo/python-list
Re: win32api install problem
On Jul 20, 9:57 am, Tim Golden wrote: > Gerry wrote: > > I'm running Python 2.6 under XP. > > > I've installed Windows 32 extensions for Python 2.6 version 1.4 > > (pywin32-214.win32-py2.6.exe). > > > But If I try to import win32api, I get: > > > File "C:\python_projects\euler\driveletters.py", line 1, in > > import win32api > > ImportError: DLL load failed: The specified module could not be found. > > Used to be you'd get this error if you installed as a > non-admin user. Don't know if that's still an issue. > Possibility? > > TJG Not a possibility (afaict) -- I am an administrator, according to the control panel. -- http://mail.python.org/mailman/listinfo/python-list
Re: win32api install problem
Gerry wrote: I'm running Python 2.6 under XP. I've installed Windows 32 extensions for Python 2.6 version 1.4 (pywin32-214.win32-py2.6.exe). But If I try to import win32api, I get: File "C:\python_projects\euler\driveletters.py", line 1, in import win32api ImportError: DLL load failed: The specified module could not be found. Used to be you'd get this error if you installed as a non-admin user. Don't know if that's still an issue. Possibility? TJG -- http://mail.python.org/mailman/listinfo/python-list
win32api install problem
I'm running Python 2.6 under XP. I've installed Windows 32 extensions for Python 2.6 version 1.4 (pywin32-214.win32-py2.6.exe). But If I try to import win32api, I get: File "C:\python_projects\euler\driveletters.py", line 1, in import win32api ImportError: DLL load failed: The specified module could not be found. \Python26\Lib\site-packages has: 03/23/2009 08:35 AM win32 07/20/2009 09:08 AM win32com 02/18/2009 01:21 PM win32comext Can anyone offer a suggestion? Thanks, Gerry -- http://mail.python.org/mailman/listinfo/python-list
Python, the Win32api, and directing input to game clients
I'm trying to use python to create a sort of control bridge between IRC and the Neverwinter Nights game client. One direction (output) is easy; the game, conveniently, writes its logs to a text file - polling and parsing do the rest in that regard. However, input, as yet, eludes me. I've fooled around with the windows api, but both SendKeys and SendMessage fail to register on the game window. When testing in Notepad, the text and other keypresses appear as planned. They do not, however, in Neverwinter. It's been suggested on some sites I've come across that Win32API calls might not work on games because the games are coded "closer to the metal", as it were, and don't fall under the abstraction of the Win32 shell. Basically, a) can anyone give me a pointer in a direction I should be heading, and/or b) is the Win32api a dead end for this goal? Many thanks in advance. -- http://mail.python.org/mailman/listinfo/python-list
Re: GetKeyboardLayoutName Win32API
Tsolakos Stavros wrote: Hi all. I was trying to find a way to read the currently selected input layout from an app written in python. I am aware that if the app were written in C, I would have to call the GetKeyboardLayoutName() function. How can this be done in Python? I want to avoid writing an extension just for this. The function is not available through pywin32. import ctypes s = ctypes.create_unicode_buffer (1024) ctypes.windll.user32.GetKeyboardLayoutNameW (s) print s.value TJG -- http://mail.python.org/mailman/listinfo/python-list
GetKeyboardLayoutName Win32API
Hi all. I was trying to find a way to read the currently selected input layout from an app written in python. I am aware that if the app were written in C, I would have to call the GetKeyboardLayoutName() function. How can this be done in Python? I want to avoid writing an extension just for this. The function is not available through pywin32. Thank you, Stavros -- http://mail.python.org/mailman/listinfo/python-list
Re: WIn32api
On 7/02/2009 3:28 AM, K-Dawg wrote: You might like to seek out the python-win32 mailing list for stuff like this where more people tend to pay attention to windows problems. This works if I call run() specifically. But when I try to initiate the thread with .start() I get the following error Unfortunately threads and COM are tricky. The short story is that you can't, in the general case, pass a COM object from one thread to another. You need to google "COM threading models", and if you *really* want to pass objects between threads, the impressively named MSCOM function CoMarshalInterThreadInterfaceInStream (exposed via the pythoncom module). The above mailing list has had a number of threads on this issue over the years... Cheers, Mark -- http://mail.python.org/mailman/listinfo/python-list
Re: WIn32api
I have come up with what I need and will try tweaking some things that hopefully will help me learn what some of this stuff does. In the meantime, I am having an issue: class *KeepAlive*(threading.Thread): def *__init__*(*self*): *self*.count = 0 *self*.ie=win32com.client.Dispatch(*'internetexplorer.application'*) *self*.ie.Visible=0 threading.Thread.__init__(*self*) def *run*(*self*): *self*.ie.Navigate(URL) sleep(5) while True: sleep(1) *self*.count += 1 *self*.timeLeft = str((300 - *self*.count)/60) + *":"* + str(( 300 - *self*.count)%60) + *" until next refresh" * print *self*.timeLeft if *self*.count == 300: *self*.ie.Refresh() *self*.count = 0 This works if I call run() specifically. But when I try to initiate the thread with .start() I get the following error Exception in thread Thread-1: Traceback (most recent call last): File "C:\Python25\lib\threading.py", line 486, in __bootstrap_inner self.run() File "C:\app.py", line 104, in run self.ie.Navigate(URL) File "C:\Python25\lib\site-packages\win32com\client\dynamic.py", line 500, in __getattr__ raise AttributeError, "%s.%s" % (self._username_, attr) AttributeError: internetexplorer.application.Navigate What does this mean? Why is it only happening when I am trying to do this in a thread? Thanks for any help. Kevin -- http://mail.python.org/mailman/listinfo/python-list
WIn32api
Hi, I have a python script that I want to run in the system tray and system tray only (windows system). I am looking at the win32gui_taskbar.py demo file but am having trouble making sense of what parts do. I understand what the whole does but I want to actually learn what it is doing so I can apply it, not just copy and paste parts to make it work the way I want. I have searched for some kind of explanation or tutorial on this and have come up empty. Is there anything out there? Thanks. Kevin -- http://mail.python.org/mailman/listinfo/python-list
Re: Problems downloading and installing win32api
On Sep 8, 2:41 pm, Emile van Sebille <[EMAIL PROTECTED]> wrote: > brianrpsgt1 wrote: > > I have attempted downloading and installing several different version > > of the win32api from Source Forge, > > Whe win32 tools come bundled with ActiveState's python distribution. > > Maybe that'll move you forward... > > Emile > > however, each time I try to install > > > > > I get the following error message: > > > "Only part of a ReadProcessMemory or WriteProcessMemory request was > > completed" > > > This occurred with the following files: > > pywin32-212.win32-py2.4.exe > > pywin32-212.win32-py2.5.exe > > pywin32-212.win32-py2.6.exe > > > I am using WinXP SP2. Any assistance on getting this downloaded and > > installed would be great. > > > Thanks > > > B > > -- > >http://mail.python.org/mailman/listinfo/python-list- Hide quoted text - > > - Show quoted text - I may have a copy if it is legal to distribute I will post it if you still need it. You will notice that sourceforge has changed the way they are doing things. As you may know they are a money loosing public company and to help combat this they have changed thier website to show less advertising and have cut the projects off from thier home page. They are offering services now to help you do what is listed on the original web site. You may have other things that don't work also. I have a slow connection so tell me if you can't find it somewhere else first. -- http://mail.python.org/mailman/listinfo/python-list
Re: Problems downloading and installing win32api
brianrpsgt1 wrote: I have attempted downloading and installing several different version of the win32api from Source Forge, Whe win32 tools come bundled with ActiveState's python distribution. Maybe that'll move you forward... Emile however, each time I try to install I get the following error message: "Only part of a ReadProcessMemory or WriteProcessMemory request was completed" This occurred with the following files: pywin32-212.win32-py2.4.exe pywin32-212.win32-py2.5.exe pywin32-212.win32-py2.6.exe I am using WinXP SP2. Any assistance on getting this downloaded and installed would be great. Thanks B -- http://mail.python.org/mailman/listinfo/python-list -- http://mail.python.org/mailman/listinfo/python-list
Problems downloading and installing win32api
I have attempted downloading and installing several different version of the win32api from Source Forge, however, each time I try to install I get the following error message: "Only part of a ReadProcessMemory or WriteProcessMemory request was completed" This occurred with the following files: pywin32-212.win32-py2.4.exe pywin32-212.win32-py2.5.exe pywin32-212.win32-py2.6.exe I am using WinXP SP2. Any assistance on getting this downloaded and installed would be great. Thanks B -- http://mail.python.org/mailman/listinfo/python-list
Re: calling NetShareEnum win32api with ctypes
En Thu, 28 Aug 2008 02:01:23 -0300, taghi <[EMAIL PROTECTED]> escribi�: I want to call NetShareEnum, a function from netapi32.dll NetShareEnum has this definition: [...] netapi32=cdll.LoadLibrary('netapi32.dll') netapi32.NetShareEnum(cname, level, byref(bufptr), prefmaxlen, byref(entriesread), byref(totalentries), byref(resume)) but I get this error: Traceback (most recent call last): File "", line 1, in s.NetShareEnum(name, level, byref(bufptr), prefmaxlen, entriesread, totalentries, resume) ValueError: Procedure called with not enough arguments (28 bytes missing) or wrong calling convention Try with netapi32=windll.netapi32 instead -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list
Re: calling NetShareEnum win32api with ctypes
taghi wrote: I wrote this code in python 2.5: from ctypes import * ... snip ... netapi32=cdll.LoadLibrary('netapi32.dll') This is your problem: netapi32 is a windows DLL and needs to be attached as such: netapi32 = windll.LoadLibrary ("netapi32.dll") or, more simply: netapi32 = windll.netapi32 But see my other post re this function in pywin32 TJG -- http://mail.python.org/mailman/listinfo/python-list
Re: calling NetShareEnum win32api with ctypes
taghi wrote: I wrote this code in python 2.5: from ctypes import * ... snip ... netapi32=cdll.LoadLibrary('netapi32.dll') This is your problem: netapi32 is a windows DLL and needs to be attached as such: netapi32 = windll.LoadLibrary ("netapi32.dll") or, more simply: netapi32 = windll.net32api But see my other post re this function in pywin32 TJG -- http://mail.python.org/mailman/listinfo/python-list
Re: calling NetShareEnum win32api with ctypes
taghi wrote: I want to call NetShareEnum, a function from netapi32.dll Not a straightforward answer but... are you aware that this particular call is already wrapped by the pywin32 packages: https://sourceforge.net/projects/pywin32/ http://timgolden.me.uk/pywin32-docs/win32net__NetShareEnum_meth.html TJG PS Is it me or is SourceForge's latest redesign actually less useful than its last one? -- http://mail.python.org/mailman/listinfo/python-list
Re: calling NetShareEnum win32api with ctypes
On Aug 28, 12:01 am, taghi <[EMAIL PROTECTED]> wrote: > I want to call NetShareEnum, a function from netapi32.dll > NetShareEnum has this definition: > > NET_API_STATUS NetShareEnum( > __in LPWSTR servername, > __in DWORD level, > __out LPBYTE *bufptr, > __in DWORD prefmaxlen, > __out LPDWORD entriesread, > __out LPDWORD totalentries, > __inout LPDWORD resume_handle > ); > > I wrote this code in python 2.5: > > from ctypes import * > > cname=c_wchar_p('a-computer-name') > level=c_int(1) > bufptr=create_string_buffer('\00', 1) > prefmaxlen=c_int() > entriesread=c_long(0) > totalentries=c_long(0) > resume=c_long(0) > > netapi32=cdll.LoadLibrary('netapi32.dll') > netapi32.NetShareEnum(cname, level, byref(bufptr), prefmaxlen, > byref(entriesread), byref(totalentries), byref(resume)) > > but I get this error: > Traceback (most recent call last): > File "", line 1, in > s.NetShareEnum(name, level, byref(bufptr), prefmaxlen, > entriesread, totalentries, resume) > ValueError: Procedure called with not enough arguments (28 bytes > missing) or wrong calling convention > > entriesread and totalentries has valid values after call but bufptr is > not. > I pass bufptr to function instead of byref(bufptr) but the error was > same. Taghi, I just learned how to do this myself. I tested this revision on WinXP Python 2.5. from ctypes import * netapi32= cdll.LoadLibrary( 'netapi32.dll' ) cname=c_wchar_p('[mycompname]') level=c_int(1) #bufptr=create_string_buffer('\00', 1) bufptr=c_void_p(0) prefmaxlen=c_int() entriesread=c_long(0) totalentries=c_long(0) resume=c_long(0) prototype= WINFUNCTYPE( c_int, c_wchar_p, c_int, POINTER( c_void_p ), c_int, POINTER( c_long ), POINTER( c_long ), POINTER( c_long ) ) NetShareEnum= prototype( ( "NetShareEnum", netapi32 ) ) result= NetShareEnum(cname, level, pointer(bufptr), prefmaxlen, byref(entriesread), byref(totalentries), byref(resume) ) print result print cname, level, bufptr, prefmaxlen, entriesread, totalentries, resume The 'bufptr' parameter receives a pointer to a buffer on return, which you then have to free using NetApiBufferFree. Here is my output: 0 c_wchar_p(u'[mycompname]') c_long(1) c_void_p(2382504) c_long() c_long(2) c_l ong(2) c_long(0) 'bufptr' now points to an array of SHARE_INFO_1 structures, which you will have to define too. It copied 2/2 entries, or 'entriesread' / 'totalentries'. Return 0 indicates success. -- http://mail.python.org/mailman/listinfo/python-list
calling NetShareEnum win32api with ctypes
I want to call NetShareEnum, a function from netapi32.dll NetShareEnum has this definition: NET_API_STATUS NetShareEnum( __in LPWSTR servername, __in DWORD level, __outLPBYTE *bufptr, __in DWORD prefmaxlen, __outLPDWORD entriesread, __outLPDWORD totalentries, __inout LPDWORD resume_handle ); I wrote this code in python 2.5: from ctypes import * cname=c_wchar_p('a-computer-name') level=c_int(1) bufptr=create_string_buffer('\00', 1) prefmaxlen=c_int() entriesread=c_long(0) totalentries=c_long(0) resume=c_long(0) netapi32=cdll.LoadLibrary('netapi32.dll') netapi32.NetShareEnum(cname, level, byref(bufptr), prefmaxlen, byref(entriesread), byref(totalentries), byref(resume)) but I get this error: Traceback (most recent call last): File "", line 1, in s.NetShareEnum(name, level, byref(bufptr), prefmaxlen, entriesread, totalentries, resume) ValueError: Procedure called with not enough arguments (28 bytes missing) or wrong calling convention entriesread and totalentries has valid values after call but bufptr is not. I pass bufptr to function instead of byref(bufptr) but the error was same. -- http://mail.python.org/mailman/listinfo/python-list
calling NetShareEnum win32api with ctypes
I want to call NetShareEnum, a function from netapi32.dll NetShareEnum has this definition: NET_API_STATUS NetShareEnum( __in LPWSTR servername, __in DWORD level, __outLPBYTE *bufptr, __in DWORD prefmaxlen, __outLPDWORD entriesread, __outLPDWORD totalentries, __inout LPDWORD resume_handle ); I wrote this code in python 2.5: from ctypes import * cname=c_wchar_p('a-computer-name') level=c_int(1) bufptr=create_string_buffer('\00', 1) prefmaxlen=c_int() entriesread=c_long(0) totalentries=c_long(0) resume=c_long(0) netapi32=cdll.LoadLibrary('netapi32.dll') netapi32.NetShareEnum(cname, level, byref(bufptr), prefmaxlen, byref(entriesread), byref(totalentries), byref(resume)) but I get this error: Traceback (most recent call last): File "", line 1, in s.NetShareEnum(name, level, byref(bufptr), prefmaxlen, entriesread, totalentries, resume) ValueError: Procedure called with not enough arguments (28 bytes missing) or wrong calling convention entriesread and totalentries has valid values after call but bufptr is not. I pass bufptr to function instead of byref(bufptr) but the error was same. -- http://mail.python.org/mailman/listinfo/python-list
Re: win32api not found?
Lamonte Harris wrote: Where can I get the win32api module? I been searching all day on google and nothing, i installed https://sourceforge.net/project/showfiles.php?group_id=78018 which requires win32api and its not found... -- http://mail.python.org/mailman/listinfo/python-list I followed the links from python.org to Mark Harmond's win32 package. It loads into (in my case) c:\\Python25\\Lib\\site-packages\\win32 as win32api.pyd Also: try the import win32api command another has suggested before searching all over. HTH Steve [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list
Re: win32api not found?
On Jul 19, 8:45 pm, Michiel Overtoom <[EMAIL PROTECTED]> wrote: > On Saturday 19 July 2008 21:13:04 Lamonte Harris wrote: > > > Where can I get the win32api module? I been searching all day on google and > > nothing, i installed > >https://sourceforge.net/project/showfiles.php?group_id=78018which requires > > win32api and its not found... > If you have successfully installed the pywin32 extensions then you *will* be able to import win32api. What happens if you start the Python interactive interpreter and enter 'import win32api' ? Michael Foord http://www.ironpythoninaction.com/ > What are the actions you do and the commands you give, and what is the precise > error you get? > > Greetings, > > -- > "The ability of the OSS process to collect and harness > the collective IQ of thousands of individuals across > the Internet is simply amazing." - Vinod > Vallopillilhttp://www.catb.org/~esr/halloween/halloween4.html -- http://mail.python.org/mailman/listinfo/python-list
Re: win32api not found?
On Saturday 19 July 2008 21:13:04 Lamonte Harris wrote: > Where can I get the win32api module? I been searching all day on google and > nothing, i installed > https://sourceforge.net/project/showfiles.php?group_id=78018 which requires > win32api and its not found... What are the actions you do and the commands you give, and what is the precise error you get? Greetings, -- "The ability of the OSS process to collect and harness the collective IQ of thousands of individuals across the Internet is simply amazing." - Vinod Vallopillil http://www.catb.org/~esr/halloween/halloween4.html -- http://mail.python.org/mailman/listinfo/python-list
win32api not found?
Where can I get the win32api module? I been searching all day on google and nothing, i installed https://sourceforge.net/project/showfiles.php?group_id=78018 which requires win32api and its not found... -- http://mail.python.org/mailman/listinfo/python-list
Re: Cannot start RPy - need win32api
Thanks a mill - works like a charm! -- http://mail.python.org/mailman/listinfo/python-list
Re: Cannot start RPy - need win32api
On Apr 11, 11:47 am, [EMAIL PROTECTED] wrote: > I'm running Python 2.5.2 on Windows XP and need to interface with R, > so I downloaded the R 2.6.2 statistical package and installed it, and > did the same for RPy 1.02 (i made sure I got the version for Python > 2.5 and R 2.62.). When I go to the Python command line and type > > >>> from rpy import * > > I get the following error message: > > Traceback (most recent call last): > File "", line 1, in > from rpy import * > File "C:\Python25\lib\site-packages\rpy.py", line 88, in > import win32api > ImportError: No module named win32api > > > > What on earth is win32api, where can I find it, and where ought I to > put it? > > Thanks in advance > > Thomas Philips It's part of the PyWin32 package, which exposes a lot of the win32 processes to Python manipulation. You can get it here: https://sourceforge.net/projects/pywin32/ And documentation is here: http://aspn.activestate.com/ASPN/docs/ActivePython/2.5/pywin32/win32_modules.html Mike -- http://mail.python.org/mailman/listinfo/python-list
Cannot start RPy - need win32api
I'm running Python 2.5.2 on Windows XP and need to interface with R, so I downloaded the R 2.6.2 statistical package and installed it, and did the same for RPy 1.02 (i made sure I got the version for Python 2.5 and R 2.62.). When I go to the Python command line and type >>> from rpy import * I get the following error message: Traceback (most recent call last): File "", line 1, in from rpy import * File "C:\Python25\lib\site-packages\rpy.py", line 88, in import win32api ImportError: No module named win32api >>> What on earth is win32api, where can I find it, and where ought I to put it? Thanks in advance Thomas Philips -- http://mail.python.org/mailman/listinfo/python-list
Re: X/Linux mouse_event (like in win32api)
Thank you Jorgen. Your answer helped me a lot. -- http://mail.python.org/mailman/listinfo/python-list
Re: X/Linux mouse_event (like in win32api)
On Thu, 29 Nov 2007 01:59:20 -0800 (PST), Atila Olah <[EMAIL PROTECTED]> wrote: > Hello everyone. > I would like to be able to emit a mouse click on my xgl/compiz > desktop, like I used to do in Windows: ... > Is there a way to interact directly with the X server (or with the > kernel?) to simulate a click? And if it can't be done in Python, where > should I go? This is probably best done in Xlib, the lowest-level X11 API. See the XSendEvent() call, and feed it to Google for more information. I think there is a Python interface to Xlib, although I haven't used it. /Jorgen -- // Jorgen Grahn R'lyeh wgah'nagl fhtagn! -- http://mail.python.org/mailman/listinfo/python-list
X/Linux mouse_event (like in win32api)
Hello everyone. I would like to be able to emit a mouse click on my xgl/compiz desktop, like I used to do in Windows: win32api.mouse_event(win32con.MOUSEEVENTF_LEFTDOWN, x, y, 0) win32api.mouse_event(win32con.MOUSEEVENTF_LEFTUP, x, y, 0) I installed Python and pywin32 in wine and they both work, but I cannot extend the mouse emulation to my X desktop. Is there a way to interact directly with the X server (or with the kernel?) to simulate a click? And if it can't be done in Python, where should I go? Thank you in advance for your replies. -- http://mail.python.org/mailman/listinfo/python-list
Re: Shutting down windows using win32api
On Apr 11, 7:49 pm, Tim Golden <[EMAIL PROTECTED]> wrote: > On a whim, given the terseness of your post, I > cut-and-pasted your subject line into Google, > added "python" for good measure, and looked at > the results. > > I suggest you might do the same. Granted, maybe > this will raise more questions, but at least it > shows willing :) > > TJG use ctypes module to execute the windows api. Shutdown windows can use the follow api BOOL ExitWindowsEx( UINT uFlags, DWORD dwReason ); about the usage, u can refer to the microsoft msdn -- http://mail.python.org/mailman/listinfo/python-list
Re: Shutting down windows using win32api
On a whim, given the terseness of your post, I cut-and-pasted your subject line into Google, added "python" for good measure, and looked at the results. I suggest you might do the same. Granted, maybe this will raise more questions, but at least it shows willing :) TJG -- http://mail.python.org/mailman/listinfo/python-list
Shutting down windows using win32api
- 8:00? 8:25? 8:40? Find a flick in no time with theYahoo! Search movie showtime shortcut.-- http://mail.python.org/mailman/listinfo/python-list
Re: good documentation about win32api ??
"__schronos__" wrote: > Hi all. > > Recently I've to developed a project in python that made operation > under win32 platform and I found a lot of problema to find good > information. The only one documentation is in ActivePython page > (http://aspn.activestate.com/ASPN/docs/ASPNTOC-APYTH2.4.0) but it is > not very good and finally I had to turn to the newsgroups (it was very > nice). > > And the question is: ¿Anybody knows where can I find good > documentation about win32api? > > Thanks in advanced. The pywin32 package has a .chm help file that covers the modules, objects and methods. Also, there are demos of many of the functions and interfaces. Roger == Posted via Newsfeeds.Com - Unlimited-Unrestricted-Secure Usenet News== http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups = East and West-Coast Server Farms - Total Privacy via Encryption = -- http://mail.python.org/mailman/listinfo/python-list
Re: good documentation about win32api ??
krishnakant Mane schrieb: > On 1 Dec 2006 09:56:09 -0800, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > >> http://msdn.microsoft.com covers the API itself, although you need to >> transliterate from the C code to python. > Exactly! that's where the problem lyes. > I am pritty well to do with windows API, I am an a good python > programmer, but I can't find the link between the two. > there are modules but no good documentation. > krishnakant. Maybe then ctypes is the right thing for you? Thomas -- http://mail.python.org/mailman/listinfo/python-list
Re: good documentation about win32api ??
On 1 Dec 2006 09:56:09 -0800, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > http://msdn.microsoft.com covers the API itself, although you need to > transliterate from the C code to python. Exactly! that's where the problem lyes. I am pritty well to do with windows API, I am an a good python programmer, but I can't find the link between the two. there are modules but no good documentation. krishnakant. -- http://mail.python.org/mailman/listinfo/python-list
Re: good documentation about win32api ??
__schronos__ wrote: > Hi all. > > Recently I've to developed a project in python that made operation > under win32 platform and I found a lot of problema to find good > information. The only one documentation is in ActivePython page > (http://aspn.activestate.com/ASPN/docs/ASPNTOC-APYTH2.4.0) but it is > not very good and finally I had to turn to the newsgroups (it was very > nice). > > And the question is: ¿Anybody knows where can I find good > documentation about win32api? > > Thanks in advanced. > > ScnS. http://msdn.microsoft.com covers the API itself, although you need to transliterate from the C code to python. -- http://mail.python.org/mailman/listinfo/python-list
Re: good documentation about win32api ??
"__schronos__" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] And the question is: ¿Anybody knows where can I find good documentation about win32api? There is the book, Python Programming on WIN32, by Mark Hammond. http://www.amazon.com/Python-Programming-WIN32-Mark-Hammond/dp/1565926218/sr=8-1/qid=1164989859/ref=pd_bbs_sr_1/103-2563546-7494224?ie=UTF8&s=books -- Paul -- http://mail.python.org/mailman/listinfo/python-list
good documentation about win32api ??
Hi all. Recently I've to developed a project in python that made operation under win32 platform and I found a lot of problema to find good information. The only one documentation is in ActivePython page (http://aspn.activestate.com/ASPN/docs/ASPNTOC-APYTH2.4.0) but it is not very good and finally I had to turn to the newsgroups (it was very nice). And the question is: ¿Anybody knows where can I find good documentation about win32api? Thanks in advanced. ScnS. -- http://mail.python.org/mailman/listinfo/python-list
"no module named win32api" using PyWin32-208
Hi. I have Python 2.4 installed on my local machine in c:\Python24. I have also downloaded the python for windows extensions installer pywin32-208.win32-py2.4.exe and installed this to C:\Python24\Lib\site-packages Trying to run a python script through a C# console app is causing me problems: the last line of code in the following block results in a no module named win32ap error. I'm not sure if this is because there is no win32api.py in the win32 fikder off site-packages, just a win32api.pyc file. m_engine = new PythonEngine(); m_engine.AddToPath("C:\\Python24\\DLLs"); m_engine.AddToPath("C:\\Python24\\lib"); m_engine.AddToPath("C:\\Python24\\lib\\plat-win"); m_engine.AddToPath("C:\\Python24\\lib\\lib-tk"); m_engine.AddToPath("C:\\Python24\\Lib\\site-packages\\pythonwin"); m_engine.AddToPath("C:\\Python24"); m_engine.AddToPath("C:\\Python24\\lib\\site-packages"); m_engine.AddToPath("C:\\Python24\\lib\\site-packages\\win32"); m_engine.AddToPath("C:\\Python24\\lib\\site-packages\\win32\\lib"); m_engine.Execute("from win32api import win32api"); I have added all the addtopaths to get the path to match the sys.path I see in a normal python console which can successfully import the module. Incidentally, I have tried making the last line m_engine.Execute("import win32api"); with no luck. Can the win32 extensions handle compiled python modules? If not how can I get it to work? Thanks, Mike -- http://mail.python.org/mailman/listinfo/python-list
Re: can't find win32api from embedded pyrun call
Miki wrote: > IIRC you need to set the path explicitly in an embedded interpreter. > See the code in "site.py" (which again IMO is *not* imported when the > interpreter starts). Thanks Miki. Actually that doesn't turn out to be the problem. If I display sys.path within the embedded script, it shows the complete list of paths, there is no need to pre-load. The problem turned out to be a mismatch of parts. For one thing, building the debug lib from Python sources using VS2005 leads to the crash in PyInitialize (I don't know why others haven't run into this); building with VS2003 did away with that. But that then led to the well-known problem with a FILE* where the app is using one msvcrt and the lib another. At some point in fixing these issues, the "cannot find win32api" went away. I now use this trick from a colleague which allows me to build a debug version of my app but load the release version of the lib: bracket the "#include python.h" statement with undef/redef of _DEBUG. And this trick to get around the FILE* problem (since my app is VS2005 and the lib is 2003): instead of PyRun_SimpleFile, use PyRun_SimpleString ("execfile(fname)"). I got this from the win32 FAQ. I hope someone benefits from this, it cost me plenty to figure out. -- Jim -- http://mail.python.org/mailman/listinfo/python-list
Re: can't find win32api from embedded pyrun call
Hello Jim, > // Py_Initialize(); > Py_InitializeEx(0); > PyRun_SimpleString("from win32com.client import *"); > > Here's what it does on the last line: > > File "D:\Python\Lib\site-packages\win32com\__init__.py", line 5, in ? > import win32api, sys, ok > ImportError: No module named win32api > > The same line runs fine in IDLE or at the command prompt. It also runs > without complaint if I run a release version of the app. To build the > debug version I had to build python42_d.lib/dll myself. The reason I > can't call PyInitialize is that it crashes with an "invalid signal" > error. > > I don't think it's a path issue -- I've checked system path, sys.path, > pythonpath env var, and the pythonpath entry in the registry, all of > them loaded with directories including the one with win32api.pyd. > Besides, if it were an install or path problem, why would it work at > the command prompt? IIRC you need to set the path explicitly in an embedded interpreter. See the code in "site.py" (which again IMO is *not* imported when the interpreter starts). HTH, Miki http://pythonwise.blogspot.com/ -- http://mail.python.org/mailman/listinfo/python-list
can't find win32api from embedded pyrun call
I am trying to figure out how to embed Python in a little C++ Windows console app. Here's the code: // Py_Initialize(); Py_InitializeEx(0); PyRun_SimpleString("from win32com.client import *"); Here's what it does on the last line: File "D:\Python\Lib\site-packages\win32com\__init__.py", line 5, in ? import win32api, sys, ok ImportError: No module named win32api The same line runs fine in IDLE or at the command prompt. It also runs without complaint if I run a release version of the app. To build the debug version I had to build python42_d.lib/dll myself. The reason I can't call PyInitialize is that it crashes with an "invalid signal" error. I don't think it's a path issue -- I've checked system path, sys.path, pythonpath env var, and the pythonpath entry in the registry, all of them loaded with directories including the one with win32api.pyd. Besides, if it were an install or path problem, why would it work at the command prompt? Could it be a problem with the debug lib I built? Any suggestions are welcome. -- Jim -- http://mail.python.org/mailman/listinfo/python-list
Re: Win32api, pyHook, possibly win32com, not sure XD, thats why I'm posting
[EMAIL PROTECTED] schrieb: > Is there a way to hide a python instance from the Task Manager process > list? Try sony's rootkit. Or any other. Diez -- http://mail.python.org/mailman/listinfo/python-list
Re: Win32api, pyHook, possibly win32com, not sure XD, thats why I'm posting
Hi! Rename Pythonw.exe like jtp.exe And... run: jtp.exe yourscript.pyw -- @-salutations Michel Claveau -- http://mail.python.org/mailman/listinfo/python-list
Re: Win32api, pyHook, possibly win32com, not sure XD, thats why I'm posting
I'm really trying to figure out the overall extent with which python can interact with the windows system (curious person ;D). I can't seem to find documentation on it, so if anyone could point me to that... i know python can kill processes and return what processes are running, so i was just wondering if it could hide them as well. -- http://mail.python.org/mailman/listinfo/python-list
Re: Win32api, pyHook, possibly win32com, not sure XD, thats why I'm posting
[EMAIL PROTECTED] wrote: > Is there a way to hide a python instance from the Task Manager process > list? > And your reason for wanting to know would be... -- Steve Holden +44 150 684 7255 +1 800 494 3119 Holden Web LLC/Ltd www.holdenweb.com Love me, love my blog holdenweb.blogspot.com -- http://mail.python.org/mailman/listinfo/python-list
Win32api, pyHook, possibly win32com, not sure XD, thats why I'm posting
Is there a way to hide a python instance from the Task Manager process list? -- http://mail.python.org/mailman/listinfo/python-list
Re: win32api .GetFileVersionInfo()
xytho33 wrote: I need to be able to programatically get the version info from a windows DLL preferably in the same format as what is displayed in the properties tab. [snip] You already posted this about forty minutes earlier and Dennis Lee Bieber wrote a reply a mere ten minutes later. Please be patient and check for replies before reposting. -- http://mail.python.org/mailman/listinfo/python-list
win32api .GetFileVersionInfo()
I need to be able to programatically get the version info from a windows DLL preferably in the same format as what is displayed in the properties tab. I was overjoyed to find Mark Hammond's Python Extensions (http://starship.python.net/crew/mhammond/) The package includes a little demo program "filevers.py" distributed in the win32api download that does exactly what I need. Unfortunately I get this error when I execute the script: C:\work>getfilever.py Traceback (most recent call last): File "C:\work\getfilever.py", line 8, in ? d=win32api.GetFileVersionInfo(fname, '\\') pywintypes.error: (1812, 'GetFileVersionInfo:GetFileVersionInfoSize', 'The specified image file did not contain a resource section.') Anybody know what this means, or more importantly, if there is a work-around? "fname", in the code snippit above, contains the name of a DLL compiled with MS Visual Studio .NET 2003. Thanks, -- http://mail.python.org/mailman/listinfo/python-list
Re: Win32api shellexecute Bshow
Thanks, I'll take a look at using GhostScript and GSPrint instead. Josh -- http://mail.python.org/mailman/listinfo/python-list
Re: Win32api shellexecute Bshow
Acrobat is stupid like this. I haven't yet found a way to prevent it from launching a new window, so I gave up and went with GhostScript and GSPrint instead. Works fabulously. -- http://mail.python.org/mailman/listinfo/python-list
Win32api shellexecute Bshow
Hi All, I am trying to print a pdf file from python using the Win32api shellexecute method and am having a problem, or perhaps just a misunderstanding, with the bshow parameter. Am I correct to assume that if the bshow parm is set to 0, that the program will not show when launched? e.g.: win32api.ShellExecute (0, "print", "test.pdf", None, ".", 0) When this statment is executed, Adobe Acrobat is launched and made visible to the user, however the actual PDF is hidden. I do not wish for Acrobat to be seen either. Any thoughts? Thanks Josh -- http://mail.python.org/mailman/listinfo/python-list