Re: [python-win32] Using pip to install pywin32

2015-02-20 Thread Kevin Horn
On Fri, Feb 20, 2015 at 8:07 AM, Vernon D. Cole vernondc...@gmail.com
wrote:

 Pywin32 is mostly written in C, and has lots of dependencies and weird
 build requirements.  In order to compile it, you must have the same C
 compiler that your release of Python was built with. For older Python
 versions (like 2.7) that compiler is obsolete and hard to find, so installs
 from source are pretty nearly impossible.


Microsoft provides a compiler package for Python 2.7 specifically for
creating binary wheels (and other binary distros):
http://www.microsoft.com/en-us/download/details.aspx?id=44266



   Would a binary wheel be able to do all of the crazy set up that the
 Windows installer does?


No it wouldn't, but a lot of the postinstall stuff isn't necessary for many
uses of pywin32.  It's probably still worthwhile to package it as a wheel
for those use cases.

At least it's useful enough that there's an alternate distribution called
pypiwin32:
https://pypi.python.org/pypi/pypiwin32


 The project is open source, and patches are happily accepted.


According to the bug I referenced above, the only thing necessary to get
most functionality working is a tweak to the path files.

Also according to the same bug, it looks as though those involved couldn't
figure out where to send patches.  Where should patches/contributions be
sent in order to get the attention of those who can merge them?





 On Thu, Feb 19, 2015 at 11:39 PM, Kevin Horn kevin.h...@gmail.com wrote:

 check out this bug:
 http://sourceforge.net/p/pywin32/bugs/669/

 There's been some interest, but the pywin32 developers themselves don't
 seem to have gotten involved.

 I'm not sure why.  It would be really nice to have pywin32 be
 pip-installable.



 On Thu, Feb 19, 2015 at 4:23 AM, Chris Angelico ros...@gmail.com wrote:

 Has anyone successfully pip installed the pywin32 package? I'm having
 some trouble with it at the moment. In theory, it should be easier to
 instruct people to type pip install pywin32 than go to the
 sourceforge download page, pick the right installer, and run it; but
 the installer is currently failing.

 Full log is available if people want it, but what I'm seeing in it is
 a number of lines like:

 Analyzing links from page
 http://sourceforge.net/projects/pywin32/files/pywin32/

 It never gets to the point of searching the build-specific pages, eg:

 http://sourceforge.net/projects/pywin32/files/pywin32/Build%20219/

 Is there a way to tell pip how to find the file?

 All advice gratefully received!

 ChrisA
 ___
 python-win32 mailing list
 python-win32@python.org
 https://mail.python.org/mailman/listinfo/python-win32




 --
 --
 Kevin Horn

 ___
 python-win32 mailing list
 python-win32@python.org
 https://mail.python.org/mailman/listinfo/python-win32





-- 
--
Kevin Horn
___
python-win32 mailing list
python-win32@python.org
https://mail.python.org/mailman/listinfo/python-win32


Re: [python-win32] Using pip to install pywin32

2015-02-19 Thread Kevin Horn
check out this bug:
http://sourceforge.net/p/pywin32/bugs/669/

There's been some interest, but the pywin32 developers themselves don't
seem to have gotten involved.

I'm not sure why.  It would be really nice to have pywin32 be
pip-installable.



On Thu, Feb 19, 2015 at 4:23 AM, Chris Angelico ros...@gmail.com wrote:

 Has anyone successfully pip installed the pywin32 package? I'm having
 some trouble with it at the moment. In theory, it should be easier to
 instruct people to type pip install pywin32 than go to the
 sourceforge download page, pick the right installer, and run it; but
 the installer is currently failing.

 Full log is available if people want it, but what I'm seeing in it is
 a number of lines like:

 Analyzing links from page
 http://sourceforge.net/projects/pywin32/files/pywin32/

 It never gets to the point of searching the build-specific pages, eg:

 http://sourceforge.net/projects/pywin32/files/pywin32/Build%20219/

 Is there a way to tell pip how to find the file?

 All advice gratefully received!

 ChrisA
 ___
 python-win32 mailing list
 python-win32@python.org
 https://mail.python.org/mailman/listinfo/python-win32




-- 
--
Kevin Horn
___
python-win32 mailing list
python-win32@python.org
https://mail.python.org/mailman/listinfo/python-win32


[python-win32] Importing tempfile (or random) results in disaster...

2012-05-31 Thread Kevin Horn
I'm setting up a new machine (Win7) and one of the first things I thought
I'd do is install Python, distribute, pip, virtualenv, etc.

However, I can't seem to get that far.

When trying to install distribute (using distribute_setup.py), I get the
following traceback:

Traceback (most recent call last):
  File distribute_setup.py, line 20, in module
import tempfile
  File C:\Python27\lib\tempfile.py, line 34, in module
from random import Random as _Random
  File C:\Python27\lib\random.py, line 881, in module
_inst = Random()
  File C:\Python27\lib\random.py, line 97, in __init__
self.seed(x)
  File C:\Python27\lib\random.py, line 111, in seed
a = long(_hexlify(_urandom(16)), 16)
WindowsError: [Error -2146893818] Invalid Signature

Huh, I thought.  That's weird.

A little googling turned up this bug:

http://bugs.python.org/issue13524

Which has the same traceback, but purports to have something to do with not
passing the right environment to the subprocess module (and is marked as
Wontfix).

But this doesn't seem to me to be the problem, as I'm not using the
subprocess module.  In fact, here is the minimal reproducible example on my
machine:

tfile.py:
import tempfile



That's it.  Just import tempfile and Python comes to a screeching halt.
In fact, import random does this as well, and either one will also cause
the traceback from within the interactive interpreter.

What's going on here?  Is this a Win7 thing?  I have 2.7.3 working on XP
and Vista without a problem.

Any pointers?

Kevin Horn
___
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32


[python-win32] Fwd: Importing tempfile (or random) results in disaster...

2012-05-31 Thread Kevin Horn
On Thu, May 31, 2012 at 11:09 AM, Tim Golden m...@timgolden.me.uk wrote:

 On 31/05/2012 14:40, Kevin Horn wrote:
  I'm setting up a new machine (Win7) and one of the first things I
  thought I'd do is install Python, distribute, pip, virtualenv, etc.
 
  However, I can't seem to get that far.
 
  When trying to install distribute (using distribute_setup.py), I get the
  following traceback:
 
  Traceback (most recent call last):
File distribute_setup.py, line 20, in module
  import tempfile
File C:\Python27\lib\tempfile.py, line 34, in module
  from random import Random as _Random
File C:\Python27\lib\random.py, line 881, in module
  _inst = Random()
File C:\Python27\lib\random.py, line 97, in __init__
  self.seed(x)
File C:\Python27\lib\random.py, line 111, in seed
  a = long(_hexlify(_urandom(16)), 16)
  WindowsError: [Error -2146893818] Invalid Signature
 
  Huh, I thought.  That's weird.
 
  A little googling turned up this bug:
 
  http://bugs.python.org/issue13524
 
  Which has the same traceback, but purports to have something to do with
  not passing the right environment to the subprocess module (and is
  marked as Wontfix).
 
  But this doesn't seem to me to be the problem, as I'm not using the
  subprocess module.  In fact, here is the minimal reproducible example on
  my machine:
 
  tfile.py:
  import tempfile
 
 
 
  That's it.  Just import tempfile and Python comes to a screeching
  halt.  In fact, import random does this as well, and either one will
  also cause the traceback from within the interactive interpreter.
 
  What's going on here?  Is this a Win7 thing?  I have 2.7.3 working on XP
  and Vista without a problem.

 Are you inside a virtualenv? There was a venv bug recently
 which manifested itself in a similar way. Hang on...

 Have a look around here (not sure exactly which part of the
 thread to pull at) and see if anything rings bells.

  http://mail.python.org/pipermail/python-dev/2012-March/118233.html

 TJG


OK, so I have no idea what caused this, but apparently rebooting my machine
fixed it.

I guess that should have been my first instinct (thanks, Windows!).  I have
no idea why a reboot would fix this though.

Thanks for the reply though, Tim.

Kevin Horn
___
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32


Re: [python-win32] Accessing the Win32 GUI event system.

2010-04-13 Thread Kevin Horn
On Tue, Apr 13, 2010 at 4:56 PM, Tim Roberts t...@probo.com wrote:

 Colin Barnette wrote:
  I am working on the preliminary research on a pywin32 project.  I hope
  to have a utility that can enter a 'capture' mode, wherein after
  activating the mode, the user selects various open windows, and the
  utility logs their hwnds and various data concerning the windows.

 Have you seen the spyxx tool that ships with Visual Studio?  It does
 exactly this.



There's a similar tool distributed with AutoIt.  It's not fancy, but it
works well.

Kevin Horn
___
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32


Re: [python-win32] MSI installer or zip file for pywin32?

2010-04-08 Thread Kevin Horn
On Tue, Apr 6, 2010 at 5:26 PM, Mark Hammond mhamm...@skippinet.com.auwrote:

 On 7/04/2010 6:13 AM, Bill Janssen wrote:

 Just for the moment, I think I'll see if I can get things working by
 copying the DLLs into \WINDOWS\System32\, including Python26.dll.  When
 that's set, I'll see if I can remove that step -- I imagine I'd somehow
 need to build a custom version of PythonService.exe, to begin with.


 Ping me when you get to that point - it is now possible to use python.exe +
 a 'bootstrap' script to host services - it is just that I haven't made the
 transition from pythonservice.exe to a more stand-alone environment.

 Cheers,

 Mark


This sounds intriguing...where can I find out more about this?  I'm
apparently unable to figure out the right Google keywords, and I don't see
anything in the changelog...

Kevin Horn
___
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32


Re: [python-win32] COM: Volume Shadow Service through Python?

2010-03-15 Thread Kevin Horn
On Mon, Mar 15, 2010 at 1:01 PM, Robert kxrobe...@googlemail.com wrote:

 is there a way to use the VSS (as requester) from Python rather simple way
 - with COM functions or so (win32com or cytpes)?  or only through a compiled
 SWIG extension or so?

 CreateVssBackupComponents / vssapi.dll
 http://msdn.microsoft.com/en-us/library/aa381517(VS.85).aspxhttp://msdn.microsoft.com/en-us/library/aa381517%28VS.85%29.aspx
 seems to be a C++ only interface.

 There is a VSS.VSSCoordinator in the COM browser. does it have to do
 anything with that...


 Robert


Search the list archives..there was something on this a while ago, but I
can't find it just now...

Kevin Horn
___
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32


Re: [python-win32] syntax?

2010-01-18 Thread Kevin Horn
On Fri, Jan 15, 2010 at 6:26 PM, Alex Hall mehg...@gmail.com wrote:

 Hi all
 I am getting a syntax error on the line
 def sayUsedRam():
 and I am not sure why. Nothing is wrong with that line, but I was playing
 with the preceeding function when this started happening. Does anyone see
 anything obvious about these two functions that would cause an error? I do
 not always trust errors with line numbers to give me the right line number.
 Thanks in advance for any help.

 def sayLoad():
 i=0
 #get proc load, currently only first core for some reason
 load=[]
 for p in c.Win32_PerfFormattedData_PerfOS_Processor():
  load.push(p.PercentProcessorTime)
  #speaker.say(str(load))
  i=i+1
 #end for
 speaker.say(str(load[0])+, +str(load[1])
 #end def

 def sayUsedRam():
 #get total ram and ram available
 #then speak used ram as a percent, rounded to 1 place
 for info in c.Win32_OperatingSystem():
  ram=info.TotalVisibleMemorySize
  freeRam=info.FreePhysicalMemory
 #end for
 #speaker.say(toBiggestBytes(freeRam,2)+. )
 used=100-(float(freeRam)/float(ram)*100)
 speaker.say(str(round(used,1))+% ram used.)
 #end def


 Have a great day,
 Alex
 Email: mehg...@gmail.com


You appear to be missing a close paren on this line:

speaker.say(str(load[0])+, +str(load[1])

in the sayLoad() function

Kevin Horn
___
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32


Re: [python-win32] What happened to python26.dll?

2009-12-08 Thread Kevin Horn
On Tue, Dec 8, 2009 at 6:59 AM, Paul Moore p.f.mo...@gmail.com wrote:

 2009/12/8 Boar Gules intern...@prodigycomputing.com:
  Just one of those baffling security notions embedded in Explorer, I
  suppose.  Found it at the command line using
 
  dir %windir%\system32\python26.dll

 Are you on 64-bit Windows? Most of these problems seem to be caused by
 people being baffled by Win64's strange ways of redirecting
 filesystem access for 32-bit apps.

 But I'm on 32-bit Windows, so I don't know if what I'm saying is even
 true, let alone helpful :-)

 Paul.


Also, I have found that Explorer's search functionality doesn't work worth a
damn on any Windows OS late than Win2k.

I have seen these types of problems (Explorer search not finding files) on
everything WinXP and later (well, I haven't tried Windows 7 yet).  I think
it has to do with some change to the indexing...it seems to happen more
often with new files, but I haven't dug deep enough to actually prove this.

Kevin Horn
___
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32


Re: [python-win32] What happened to python26.dll?

2009-12-08 Thread Kevin Horn
On Tue, Dec 8, 2009 at 11:48 AM, Tim Roberts t...@probo.com wrote:


 People need to know that, if you install the 32-bit Python on a 64-bit
 Windows system, the DLL will be installed in %windir%\SysWow64.  (Yes,
 32-bit DLLs go in SysWow64, and 64-bit DLLs go in System32.  Really.)
 If you use a 64-bit tool to search for it, you would find it in SysWow64.

 BUT, in a 32-bit process, Windows does magic path redirection.  So, if
 you were to run os.walk in a 32-bit Python process, you would find
 python26.dll in %windir%\System32.  This can be incredibly confusing,
 since you can go out to a command line and do dir
 \windows\system32\python26.dll and it won't be there.

 This is, in my opinion, one of the things that Microsoft really botched
 in the 32-to-64 transition.

 --
 Tim Roberts, t...@probo.com
 Providenza  Boekelheide, Inc.


Ow.  I think my head just exploded.

Kevin Horn
___
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32


Re: [python-win32] Is it possible to (un)check items in Local Area Connection Properties ?

2009-10-29 Thread Kevin Horn
On Thu, Oct 29, 2009 at 5:50 PM, Stef Mientki stef.mien...@gmail.comwrote:

 thanks Kevin,

 Kevin Horn wrote:

 On Wed, Oct 28, 2009 at 4:22 PM, Stef Mientki stef.mien...@gmail.commailto:
 stef.mien...@gmail.com wrote:

hello,

For connecting though CheckPoint VPN,
I need to check the item Check Point SecuRemote in the Local
Area Connections Properties.

I couldn't find a way to read and or toggle this switch (through
some registry setting),
so I made an AutoIt program to accomplish the task.

The main disadvantage is that if the number of items above Check
Point SecuRemote changes,
the Auto-It script will (un)check the wrong item.

thanks,
Stef Mientki


 There are some python tools that do desktop automation in a fashion
 similar to what AutoIt does, but this kind of task is one of the few I
 actually don't usually use Python for.  I usually use AutoIt.

 PyWinAuto (http://pywinauto.openqa.org/) is probably the best-known of
 the windows solutions out there.  I thought there was another main one, but
 I can't find it at the moment.

 Before you go haring off looking for a new tool, have you tried getting
 the control ID using the AutoIt Winspy-thingy?  I've been able to use that
 to send messages directly to individual controls, rather than the window,
 which has helped me in similar situations.

 Hope this helps, and let us know how it works out!

 I updated my autoit script ( whole lot of trial and error :-( ,
 but it works now, the spy tip was a good one !!
 If someone is interested, the code is below.

 cheers,
 Stef

 ;**

 ;Systeem Settings
 ;**

 ;Er moet voor gezorgd worden dat LAN en VPN gesynchroniseerd zijn
 ;Het disablen van VPN by startup gaat als volgt:
 ;  Control Panel
 ; Administrative Tools
 ; Computer Management
 ; Services and Applications
 ; Services
 ;  CheckPoint SecuRemote Watchdog = manual

 ;**

 ;Define directories and window titles in some local vars
 ;**

 local $Net_Conn = Network Connections
 local $LAN_Status = Local Area Connection Status
 local $LAN_Props = Local Area Connection Properties


 ;**

 ;correct the default AutoIt settings
 ;**

 ;AutoItSetOption(TrayIconHide,0);0 = hide (after 1 second)
 AutoItSetOption(MouseCoordMode, 0)   ;1 = absolute screen coordinates
 (default)
 ;BlockInput(1)


 ;**

 ;launch Network Connections, then launch LAN_status and close Network
 Connections
 ;**

 Run(control ncpa.cpl)

 WinWait( $Net_Conn)
 If Not WinActive( $Net_Conn) Then
 WinActivate( $Net_Conn)
 EndIf

 ControlFocus( $Net_Conn, , SysListView321)
 ControlSend( $Net_Conn, , SysListView321,local)
 Send({ENTER})
 WinClose( $Net_Conn)

 ;**

 ;wait till LAN_status window active, then click on Properties
 ;**

 WinWait($LAN_Status)
 If Not WinActive($LAN_Status) Then
 WinActivate($LAN_Status)
 EndIf

 ControlFocus($LAN_Status, , Properties)
 ControlClick($LAN_Status, , Properties)
 WinClose( $LAN_Status)

 $WinText = ''
 $Name = 'Check Point SecuRemote'

 $NameIndex = ControlListView ( $LAN_Props, $WinText, 'SysListView321',
 FindItem, $Name)
 WinActivate($LAN_Props)
 WinWaitActive($LAN_Props)

 ; THIS DOESN'T WORK !!!
 ;ControlListView ( $WinTitle, $WinText, 'SysListView321', SelectClear)
 ;sleep(200)
 ;ControlListView ( $WinTitle, $WinText, 'SysListView321', Select,
 $NameIndex)
 ;sleep(200)
 ;send({space})

 For $i = 1 to $NameIndex
 Send({down})
 Next
 sleep(200)
 send({space})
 ControlClick($LAN_Props,$WinText,Button8) ;OK knop

 BlockInput(0)


No problem, glad it worked out!

Kevin Horn
___
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32


Re: [python-win32] using WMI to get processor flags...

2009-10-28 Thread Kevin Horn
On Sat, Oct 24, 2009 at 4:14 AM, Tim Golden m...@timgolden.me.uk wrote:


 The CIM_ classes represent the DMTF Common Information Model [1],
 the structure on which WMI is based. In principle other manufacturers
 could implement WMI -- or whatever they would want to call it -- but
 as far as I am aware, no-one has.



Somewhat tangential to the conversation, but WBEM/CIM is available for
Linux, Mac OS X, some Unices, and Netware:

http://www.openwbem.org/

In case anyone is interested.

Kevin Horn
___
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32


Re: [python-win32] using WMI to get processor flags...

2009-10-28 Thread Kevin Horn
On Wed, Oct 28, 2009 at 11:18 AM, Tim Golden m...@timgolden.me.uk wrote:

 Kevin Horn wrote:

 On Sat, Oct 24, 2009 at 4:14 AM, Tim Golden m...@timgolden.me.uk wrote:


  The CIM_ classes represent the DMTF Common Information Model [1],
 the structure on which WMI is based. In principle other manufacturers
 could implement WMI -- or whatever they would want to call it -- but
 as far as I am aware, no-one has.



  Somewhat tangential to the conversation, but WBEM/CIM is available for
 Linux, Mac OS X, some Unices, and Netware:

 http://www.openwbem.org/

 In case anyone is interested.


 Interesting: is it widely used / known / supported, do you know?

 [Absolutely no axe to grind: just interested as I've never seen
 it put forward when anyone asks How do I ...? on one of those
 platforms]

 TJG


Well, I don't really know from personal experience, I just recalled having
found it a while back, I thought it might be useful for a project that never
ended up happening.  From the web page, it's maintained by a company called
Quest Software, Novell is a contributor and apparently uses it in SUSE SLES
10, Apple Remote desktop is listed as using it.

Makes me think it's probably pretty solid, though as I said, I've never used
it myself.

Kevin Horn
___
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32


Re: [python-win32] using WMI to get processor flags...

2009-10-28 Thread Kevin Horn
On Fri, Oct 23, 2009 at 3:21 PM, J dreadpiratej...@gmail.com wrote:

 First, Thanks again Tim Golden :)

 I've gotten a lot of use out of WMI so far, though I'm still trying to
 get an actual list of WHAT I need as far as system info for this tool
 I'm writing.

 Now I've got another question that I hope someone can provide the
 answer I want, not the one I'm afraid is coming ;-)

 So I've been looking at Win32_Processor and it provides a lot of
 processor information that I need, like max speed, cpu stepping,
 family ID and so forth, and I can also get packages, cores, and
 logical counts.

 What I haven't been able to find is a way to get a listing of
 processor flags (like FPU, MMX, SVN, VMX, SSE3, HTT, etc).  Is there a
 way to do this without resorting to pycpuid??  Pycpuid can give me
 this stuff but it requires some compiling for systems, and I'm still
 not positive that it will work across platforms (AMD v. Intel).

 Any thoughts?  I haven't found an answer yet.  I've also looked at
 CIM_Processor, but it seems to me that the CIM classes are identical
 to the Win32 classes, at least in most cases.  I haven't dug TOO
 deeply into CIM_Processor though...

 Cheers
 Jeff


I don't know of a way to get this with WMI, though it _might_ be possible.

You might try looking at this page for some ideas:
http://www.codeguru.com/cpp/w-p/system/hardwareinformation/article.php/c9087__2/

It gives 3 ways to get processor information:
- assembly (pycpuid uses this)
- registry (there is a key in the registry that stores this info, but it
looks like it's all ORd together, so you'd have to decode it)
- Platform SDK ( IsProcessorFeaturePresent() is probably the function you
want )

The page has some C++ sample code, which might help you some.  I'd probably
either try to read the info from the registry (though you can't be 100% sure
the registry is correct, of course), or figure out what C functions to call
and wrap them up in ctypes calls.

How to integrate this with your WMI code (is it querying remote machines?)
is up to you. :)  But feel free to ask if you need ideas.

Kevin Horn
___
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32


Re: [python-win32] Is it possible to (un)check items in Local Area Connection Properties ?

2009-10-28 Thread Kevin Horn
On Wed, Oct 28, 2009 at 4:22 PM, Stef Mientki stef.mien...@gmail.comwrote:

 hello,

 For connecting though CheckPoint VPN,
 I need to check the item Check Point SecuRemote in the Local Area
 Connections Properties.

 I couldn't find a way to read and or toggle this switch (through some
 registry setting),
 so I made an AutoIt program to accomplish the task.

 The main disadvantage is that if the number of items above Check Point
 SecuRemote changes,
 the Auto-It script will (un)check the wrong item.

 thanks,
 Stef Mientki


There are some python tools that do desktop automation in a fashion similar
to what AutoIt does, but this kind of task is one of the few I actually
don't usually use Python for.  I usually use AutoIt.

PyWinAuto (http://pywinauto.openqa.org/) is probably the best-known of the
windows solutions out there.  I thought there was another main one, but I
can't find it at the moment.

Before you go haring off looking for a new tool, have you tried getting the
control ID using the AutoIt Winspy-thingy?  I've been able to use that to
send messages directly to individual controls, rather than the window, which
has helped me in similar situations.

Hope this helps, and let us know how it works out!

Kevin Horn
___
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32


Re: [python-win32] regarding asn in python

2009-10-26 Thread Kevin Horn
On Mon, Oct 26, 2009 at 6:24 AM, a h ah.k...@gmail.com wrote:

 Hi

 I want to know to that is any compiler there that could produce asn parser
 in python. actually i have an asn file and i want to decode asn base encoded
 message.
 I found an asn1c compiler that can generate output files that can be used
 to decode the message, but those files are in C or java. i want it in
 python.

 Thanks  Regards
 ah

 ___
 python-win32 mailing list
 python-win32@python.org
 http://mail.python.org/mailman/listinfo/python-win32


Well, there's this project:

http://pyasn1.sourceforge.net/

which includes BER, CER, and DER codecs, but it doesn't look like it has an
ASN compiler.

Kevin Horn
___
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32


Re: [python-win32] Paste Values only in Excel Paste Special

2009-10-23 Thread Kevin Horn
On Fri, Oct 23, 2009 at 7:32 AM, Paolo Roberto Falcao 
agnolucponpy...@googlemail.com wrote:

 Hi everyone,

 I followed (or I think I have) the advice from
 http://www.mail-archive.com/python-win32@python.org/msg06368.html
 but I  get an error when I am trying to Paste the values only from a
 spreadsheet. I simply want to increase the date in column A by one day. To
 do this, I insert a formula and then I'd like to paste the values from the
 column where I inserted the formula so I can get rid of the columns I don't
 need. The code works up to the last line but it errors when I issue the
 PasteSpecial command. I used terms like constants.xlPasteValues in the code
 to make it more comprehensible to the list. I am also aware that the use of
 syntax like Range(A2:A49) is normally frowned upon but this is just a
 small piece of code to show my problem.

 Thanks in advance

 Paolo

 ws1.Columns(A:A).Insert(Shift = -4161, CopyOrigin= 0)
 ws1.Range(A2).FormulaR1C1 = =RC[1]+1
 ws1.Range(A2).AutoFill(Destination= ws1.Range(A2:A49))
 ws1.Columns(A:A).Insert(Shift = -4161, CopyOrigin= 0)
 ws1.Range(B2).Copy()
 ws1.Range(A2).PasteSpecial(Paste = constants.xlPasteValues, Operation =
 constants.xlNone)


Can you provide a traceback?  What error are you seeing?

Kevin Horn
___
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32


[python-win32] Fwd: Python parser for Windows Event Logs

2009-07-09 Thread Kevin Horn
-- Forwarded message --
From: Kevin Horn kevin.h...@gmail.com
Date: Thu, Jul 9, 2009 at 11:26 AM
Subject: Re: [python-win32] Python parser for Windows Event Logs
To: Jaime Blasco jaime.bla...@alienvault.com


Or just use pywin32...
http://timgolden.me.uk/pywin32-docs/Windows_NT_Eventlog.html


On Thu, Jul 9, 2009 at 11:09 AM, Jaime Blasco
jaime.bla...@alienvault.comwrote:

 Check wmi module:

 http://timgolden.me.uk/python/wmi.html

 It has some functions to access windows logs..

 Regards

 2009/7/9 Tony Cappellini cappy2...@gmail.com

 Does anyone know if there is a Python module which will parse Windows
 Event Logs?
 Using the EventViewer is tedious, and I'd rather be abel to do this
 programmatically.


 Thanks
 ___
 python-win32 mailing list
 python-win32@python.org
 http://mail.python.org/mailman/listinfo/python-win32




 --
 ___

 Jaime Blasco

 www.ossim.com
 www.alienvault.com
 Email: jaime.bla...@alienvault.com


 ___
 python-win32 mailing list
 python-win32@python.org
 http://mail.python.org/mailman/listinfo/python-win32


___
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32


Re: [python-win32] Shell extension debugging

2009-06-29 Thread Kevin Horn
Just an aside on restarting explorer...

In case explorer doesn't restart automatically, you can easily start it up
again manually from the task manager (which you should have open from
killing the process).

File-NewTask, then type explorer.

I'm sure this isn't news to most people here, but I'm often surprised by ppl
not knowing this trick.

Kevin Horn

On Mon, Jun 29, 2009 at 12:24 PM, Tim Roberts t...@probo.com wrote:

 Gertjan Klein wrote:
  I've checked with Process Explorer, but even if I use the Windows
  Explorer setting Launch folder windows in a separate process there is
  still only one explorer.exe visible, which is at the root of everything
  I have open. I wouldn't want to kill that one...
 

 That's exactly what you want to do.  It's perfectly safe.  The kernel
 monitors that process and restarts it when it dies.

 --
 Tim Roberts, t...@probo.com
 Providenza  Boekelheide, Inc.

 ___
 python-win32 mailing list
 python-win32@python.org
 http://mail.python.org/mailman/listinfo/python-win32

___
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32


Re: [python-win32] Adding an exe to startup...

2008-09-16 Thread Kevin Horn
There are a number of ways to do this:

1) add a shortcut to the Startup start menu folder
2) add registry entries to various places like *
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run]
*see here for some other locations:
http://www.doshelp.com/HowToView/Registry_Keys.htm
3) make it a service and set it to Automatic (probably more work than you
want to do)
4) There are other more esoteric ways, but I think the above probably covers
anything you are likely to want to do.

Kevin Horn

On Tue, Sep 16, 2008 at 9:51 AM, Tim Golden [EMAIL PROTECTED] wrote:

 John Bunting wrote:

 I've been having some trouble finding information on how to add an exe
 that I have created to the startup of my windows box.  I would like to know
 how I should go about adding the exe to the startup menu, without using the
 gui interface.  I want to be able to automate this because I'm also going to
 be giving out some of this code to different users and I don't want to have
 to have them manually add the exe.



 The startup menu is basically a folder which you can put
 shortcuts into in the normal way. For simplicity's sake,
 I recommend using (my) winshell module:

 http://timgolden.me.uk/python/winshell.html

 but it's only a very simple wrapper around the pywin32
 extensions so you might prefer to roll your own. At
 least you can look at the source. The following code
 will do what you want (assuming you want Python to
 start up automatically!)

 code
 import os, sys
 import winshell

 startup = winshell.startup () # use common=1 for all users
 print startup

 winshell.CreateShortcut (
  Path=os.path.join (winshell.startup (), Python.lnk),
  Target=sys.executable,
  Icon=(sys.executable, 0),
  Description=Python
 )

 /code

 TJG
 ___
 python-win32 mailing list
 python-win32@python.org
 http://mail.python.org/mailman/listinfo/python-win32

___
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32


Re: [python-win32] interprocess communication python and visual basic can it be done?

2008-08-26 Thread Kevin Horn
Look into either:

COM or
Named Pipes

You could also try having a socket in each process and communicate over a
network, but I don't know how difficult socket programming is in VB

Kevin Horn

On Tue, Aug 26, 2008 at 12:07 PM, Vernon Cole [EMAIL PROTECTED] wrote:

 Emanuel:
 Best answer: Find a copy of  *Python Programming On Win32*  by Mark
 Hammond and Andy Robinson and read chapter 7. Unfortunately, copies of the
 book are getting quite hard to get.
 --
 VC

 Mark:
   New edition???
   Please!!!
 --
 VC


 On Tue, Aug 26, 2008 at 10:26 AM, Emanuel Sotelo [EMAIL PROTECTED]
 wrote:
 
  hello.
  well i have a question i dont now if it it's possible to make a
  interprocess communication between python and visual basic.
  someone tell that it can be done but i havent fond nothing about this
 subject
  if it is possible can some one give me some guide points of where to
  look or what to investigate because i just began lerning python and i
 have
  to do a proyect a bout this but i will like to get some info of how
 before i
  start develop the programan
  I would appreciate any help that anyone can provide
 
  
  Si no te acuerdas quién quedó en traer los hielos, te urge usar Skydrive
  ___
  python-win32 mailing list
  python-win32@python.org
  http://mail.python.org/mailman/listinfo/python-win32
 


 ___
 python-win32 mailing list
 python-win32@python.org
 http://mail.python.org/mailman/listinfo/python-win32


___
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32


Re: [python-win32] Querying the VNC Service fails sometimes

2008-06-23 Thread Kevin Horn
Also check the permissions on the problem users registry.  I would expect
that to cause a different error, but it might be worth checking.

Kevin Horn

On Mon, Jun 23, 2008 at 2:25 PM, Roger Upole [EMAIL PROTECTED] wrote:


 Mike Driscoll wrote:

 Mike Driscoll wrote:

 Hi,

 In one of my login scripts for work, I run a query to see if the VNC
 service is running using the win32serviceutil module. The code for
 that I am using looks something like this:

 code
 import win32serviceutil
 serviceState = win32serviceutil.QueryServiceStatus('VNC Server')[1]
 /code

 This works in 99.99% of cases. However, I have on user that keeps
 getting the following traceback:

 Traceback (most recent call last):
  File \\ourServer\pathName\PostLogon.py, line 207, in ?
   serviceState = win32serviceutil.QueryServiceStatus('VNC Server')[1]
  File

 \\ourServer\pathName\Python24\lib\site-packages\win32\lib\win32serviceutil.py,
 line 479, in QueryServiceStatus
   hs = SmartOpenService(hscm, serviceName,
 win32service.SERVICE_QUERY_STATUS)
  File

 \\ourServer\pathName\Python24\lib\site-packages\win32\lib\win32serviceutil.py,
 line 81, in SmartOpenService
   name = _GetServiceShortName(name)
  File

 \\ourServer\pathName\Python24\lib\site-packages\win32\lib\win32serviceutil.py,
 line 62, in _GetServiceShortName
   skey = win32api.RegOpenKey(hkey, svc, 0, access)
 error: (2, 'RegOpenKeyEx', 'The system cannot find the file specified.')


 I used regmon to try and figure out what part of the Registry my code
 looks at and it appears to be looking for the DisplayName value in
 HKLM\SYSTEM\CurrentControlSet\Services\winvnc

 I cannot see a difference in this user's registry versus my own, which
 does not have this issue. However, I can duplicate the error by
 connecting to the user's PC's registry using the _winreg module and
 querying the DisplayName value, like this:

 QueryValue(key, 'DisplayName')

 Which give me this traceback:

 Traceback (most recent call last):
  File pyshell#14, line 1, in module
   QueryValue(key, 'DisplayName')
 WindowsError: [Error 2] The system cannot find the file specified

 But if I use use _winreg's EnumValue, I get this:

  EnumValue(key, 4)

 ('DisplayName', u'VNC Server', 1)

 What the!? Does anyone have any suggestions? Maybe a better way to get
 the information? I only need to know if the service is running or not,
 and if not, to start it.

 Thanks!



 I forgot to mention that we use Windows XP, Python 2.4 and PyWin32
 version 210.

 Mike


 You might want to try build 211.  It uses the API function
 GetServiceKeyName instead of manually enumerating the
 registry.

 However, it sounds like you could have a corrupt registry key.
 Try reinstalling the service and see if that helps.

Roger

 ___
 python-win32 mailing list
 python-win32@python.org
 http://mail.python.org/mailman/listinfo/python-win32

___
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32


Re: [python-win32] Request for comments

2008-05-23 Thread Kevin Horn
On Thu, May 22, 2008 at 11:21 AM, Tim Golden [EMAIL PROTECTED] wrote:

 I have a request of the python-win32 community. Have a look at:

 http://timgolden.me.uk/python-on-windows/


Wow, Tim!  Thanks for doing this.


 In particular, click through to the section on the Registry (which is the
 only section which has anything useful in it!)
 and then tell me what you think. About anything. The contents,
 the style, the colours, the colors, the depth of examples, the
 notes. What should be there? What shouldn't? How much overlap
 there should be with other sources of documentation? How much
 should just be links across? Should I reproduce the pywin32 docs
 verbatim. (Difficult: I've got a branch which is trying. Very trying).
 Anything.


I'd like to see a little more prose to go with the examples, not just code.

No too much, but enough that the reader can understand WHY a certain task i
s done a certain way (and maybe why you would want to do it in the first
place).

I do like the fact that it's more of  a cookbook than stereo
instructions.
I think focusing on examples is right on target (and I love your other
Py-win HOWTO pages BTW)

Points to bear in mind:

  * This is very alpha
  * I'm using Sphinx but I've done very little with its capabilities


Sphinx can auto-create Prev and Next links, which might be useful.

Kevin Horn
___
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32


Re: [python-win32] Request for comments

2008-05-23 Thread Kevin Horn
On Fri, May 23, 2008 at 2:21 PM, Tim Golden [EMAIL PROTECTED] wrote:

 Kevin Horn wrote:

  Sphinx can auto-create Prev and Next links, which might be useful.


 Unless I misunderstand you, I think it's doing that, both across
 the top Navigation bar and along the left sidebar. Or did you
 mean something else?


Yeah, i had missed those initially, though I saw them after I sent my email.
I guess I've been trained to expect them at teh bottom and/or top corners of
the page.

Thanks for taking the trouble to respond. It is appreciated.


 TJG


No Problem. :)

Kevin Horn
___
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32


Re: [python-win32] Null Session ipc$

2008-03-21 Thread Kevin Horn
On Fri, Mar 21, 2008 at 6:18 AM, Ludovic Reenaers 
[EMAIL PROTECTED] wrote:

 -BEGIN PGP SIGNED MESSAGE-
 Hash: SHA1

 I'm not sure, but I guess It is depending on the version of windows, I
 think I had read somewhere null connection is not applicable on most
 recent windows versions...


according to:
http://www.brown.edu/Facilities/CIS/CIRT/help/netbiosnull.html

NetBIOS NULL sessions are enabled by default in Windows NT and 2000.
Windows XP and 2003 will allow anonymous enumeration of shares, but not SAM
accounts.

Note that these are only default settings...Windows systems can be
configured to allow or disallow null sessions using the registry.

Kevin Horn
___
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32


Re: [python-win32] WABAccess help ...

2008-03-12 Thread Kevin Horn
On Wed, Mar 12, 2008 at 4:28 PM, Clinton Lee Taylor 
[EMAIL PROTECTED] wrote:


 Now to figure how to get only contacts with fax numbers and print the
 name and fax number ...

 Thanks
 Mailed
 LeeT
 ___
 python-win32 mailing list
 python-win32@python.org
 http://mail.python.org/mailman/listinfo/python-win32



Unless you're dealing with a really large number of contacts, I would
probably just do the Simplest Possible Thing(tm) and read the all into a
list, filter the list using a list comprehension, then print the results.

But that's just me...I like to get out of COM as soon as possible :)

Kevin Horn
___
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32


[python-win32] Fwd: Using Python and WMI for multiple machines

2008-02-20 Thread Kevin Horn
On Feb 20, 2008 3:04 AM, Tim Golden [EMAIL PROTECTED] wrote:

 Becky Mcquilling wrote:
  I'm new to Python and wanted to do what is a pretty routine and common
 admin
  function,  simple enough in VBScript, but wanted to try it in Python as
  well.  I'm having troulbe working it out on my own.

 Welcome to Python!

  I have a text file c:\servernames.txt.  I want the script to read from
 that
  file, each line being a different machine name, then give me a list of
 the
  services on the machine and the state, write the result to a log file.

 Reading lines from a file is easy enough. My own preference
 is this:

   servers = open (c:/servernames.txt).read ().splitlines ()

 because it strips off the trailing line feeds, but there
 are several alternatives.

  The wmi part is easy to produce, on a single machine, it's stripping the
  contents from a text file one at a time and then logging it to a file,
 that
  I havne't gotten quite right.

 It's not entirely clear what you want to log and to how many files, but
 assuming that:

 a) You're using the wmi module from:
http://timgolden.me.uk/python/wmi.html

 b) You have a list of servers in c:\servernames.txt

 c) You want the list of services from each machine
 to go into a file called servername-services.log

 then this code should at least give you an outline:

 One caveat: because in Python, as in other languages,
 the backslash acts as a special-character escape, you
 either need to double them up in Windows filenames,
 (c:\\server...) or use raw strings (rc:\server..)
 or use forward slashes (c:/server...)

 code - untested
 import wmi

 servers = open (c:/servernames.txt).read ().splitlines ()
 for server in servers:
   wmi_connection = wmi.WMI (server)
   with open (%s-services.log % server, w) as f:
 for service in wmi_connection.Win32_Service ():
   f.write (%s\t%s\n % (service.Caption, service.State))

 /code

 HTH
 TJG
 ___
 python-win32 mailing list
 python-win32@python.org
 http://mail.python.org/mailman/listinfo/python-win32



Note that the above code will only work under Python 2.5, since that's when
the with statement was added.

(Some of us are still stuck in 2.4 land :) )

In 2.4 and earlier, it could look something more like:

code - untested
import wmi

servers = open (c:/servernames.txt).read ().splitlines ()
for server in servers:
  wmi_connection = wmi.WMI (server)
  f = open (%s-services.log % server, w)
  for service in wmi_connection.Win32_Service ():
  f.write (%s\t%s\n % (service.Caption, service.State))
  f.close()

/code

Kevin Horn
___
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32


[python-win32] Fwd: Building win32 extensions to Python

2006-06-15 Thread Kevin Horn
Another option might be to wrap your C code using the ctypes module (
http://starship.python.net/crew/theller/ctypes/). This might be especially attractive if this code is mostly for demo purposes (at least for demo purposes on win32). Ctypes basically allows you to call C code from python, but rather than handling the data type translations in C (like in a normal extension), you handle the translations in Python.
For C++ code you might check out boost.python. I haven't used it but I've heard good things.Kevin H.On 6/15/06, 
James Carroll 
[EMAIL PROTECTED] wrote:Hi Chris,I would recommend buying Visual Studio.It's what python 
2.4 is builtwith, and it makes compiling extensions nice and easy.My favorite examples of extending python include: - screengrabber extension for the python imaging library

http://effbot.org/downloads/1) download and install the Python imaging library (PIL)2) download the screengrabber source and uncompress to a directory.3) look at the _screengrab.c (or whatever it is called) to see how it
accepts and returns python argumetns, but does win32 calls inbetween.4) run  python setup.py build  to invoke Visual C++ (or mingw if detected.)5) run  python setup.py install  to try it interactively.
 - My second favorote example is on the wxPython Wiki, it shows how toextend wxPython with commercial VC++
http://wiki.wxpython.org/index.cgi/C%2B%2BExtensions
I wrote the pages for VisualStudioExtenions and SconsExtensions, solet me know if you need them to be more helpful.I wrote themhastily, but I think I got the important parts right.-Jim

On 6/15/06, chris botos [EMAIL PROTECTED] wrote: This sounds like a plan.I'll give it a try.Thanks, Paul.
 Chris
 On 6/15/06, Paul Moore [EMAIL PROTECTED] wrote:  On 6/15/06, Chris Botos 
[EMAIL PROTECTED]
 wrote:   3)I downloaded and installed:   .NET Framework SDK Version 1.1   Visual C++ 2005 Express Edition, that first installs .NET Framework 2.0   (note that I could not get to a download for the 2003 version on
   Microsoft's site and the only other download site I found was at   softpedia, and the download link there is broken )   I've only skimmed your post briefly, but this is likely your problem.
  Python extensions cannot be built with Visual C++ 2005 (incompatible C  runtime), so this doesn't work. You need the Visual C++ Toolkit  Edition, but MS no longer seem to supply this :-( If you can get
  someone who has a copy to send it to you, that would be one option -  but it's a 32MB file, and I don't know the redistribution conditions,  it's probably not allowed, so you may have problems there).
   The other option is to install Mingw (from www.mingw.org), and build  using 
setup.py build --compiler=mingw32. This works fine, unless your  extension code uses MSVC specific extensions. The instructions in the
  Python docs are a little out of date, I believe. With Python 2.4, you  shouldn't need to do anything more than install mingw, make sure gcc  is on your path, and run setup.py as above. You can even edit the
  distutils config file (I can't remember its location offhand, sorry)  to specify that distutils should use mingw by default.   Hope this helps,  Paul. 
 ___ Python-win32 mailing list 
Python-win32@python.org 
http://mail.python.org/mailman/listinfo/python-win32___Python-win32 mailing list
Python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32



___
Python-win32 mailing list
Python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32