Re: [python-win32] FIle I/O on Windows XP

2009-06-15 Thread python
Hi Tony,

> I was trying to see if I could speed up processing huge files (in the 10's of 
> Gigabytes) by passing various values to the readline() method of the file 
> object.

We also work with large sized text files (we use Python for ETL jobs in
the 100-200 Gb range) and have noticed similar behaviors.

We're currently running 32 and 64 bit versions of Python 2.6.1 on
Windows XP (32-bit/2 Gb) and Windows 2008 (64-bit/48 Gb) with SCSI and
eSATA drives. All our file access is local (vs. over a network) and the
boxes our jobs run on are dedicated machines running nothing else but
our Python scripts. Our boxes are on an isolated network and we have no
virus checking software running in the background.

Since our boxes are maxed out with memory, we thought that supplying
large buffer sizes to open() would improve performance. Like you, we
were surprised that this strategy significantly slowed down our
processing.

We're currently opening our text files via open() and allowing Python to
choose the default buffer size. My experience with Python is that many
performance enhancement techniques are not (initially) intuitive - but
my gut tells me that the behavior we are both seeing is *NOT* one of
these cases, eg. something smells fishy.

I'm happy to run experiments on our side if anyone has suggestions.

Thanks for bringing this up.

Regards,
Malcolm
_______
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32


[python-win32] Read USB memory stick serial number

2009-12-29 Thread python
Apparently retrieving the serial number of a USB memory stick is
much more complicated than one would think.

Is there a published Python recipe for determining a USB memory
stick's device level serial number under Windows and/or
Linux/Mac?

My Windows research follows my signature. Any feedback
appreciated.

Regards,
Malcolm

1. Here's a VBS script that attempts to use WMI to retrieve a USB
serial number. This script reports my USB drive as PHYSICALDRIVE4
with an empty serial number. Based on this experiment, it looks
like WMI does not have access to the information we're looking
for.

set svc = getobject ( "winmgmts:root\cimv2" )
set objEnum = svc.execQuery ( "select SerialNumber from
win32_physicalMedia ")
s1 = ""
for each obj in objEnum
s1 = s1 + obj.GetObjectText_ + VBCR
next
wscript.echo s1

2. Here's what I found on my 64-bit Windows 7 Professional
registry using the following registry key I discovered during my
research on this topic[1]:
- Key:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\USBSTOR\Enum
- Value: 0 = USB\VID_13FE&PID_1D00\5B7A11000302
Here's how the above value breaks out (text in parentheses are my
own notes):
- VID: 13FE (vendor id; Kingston Technology Company Inc.)
- PID: 1D00 (product id; DataTraveler 2.0 1GB/4GB Flash Drive)
- S/N: 5B7A11000302

Unfortunately, I don't know how one would identify a specific
device if multiple devices were present (I don't have multiple
memory sticks to test against yet). I assume that one technique
would be to enumerate against similar keys and/or values (0...N)?
I also don't know how portable this technique (key/value) is
across various flavors of Windows.
3. Here's what VOL returns from CMD shell via VOL D:
Volume serial number: 7644-2554

This serial number can be changed by a user via the LABEL
command. This serial number does not appear to be mathematically
related to the USB serial number.

References:

[1] USBDeview is a small utility that lists all USB devices that
are currently connected to your computer, as well as all USB
devices that you previously used. For each USB device, extended
information is displayed: Device name/description, device type,
serial number (for mass storage devices), the date/time that
device was added, VendorID, ProductID, and more.
http://www.nirsoft.net/utils/usb_devices_view.html
___
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32


Re: [python-win32] Read USB memory stick serial number

2009-12-29 Thread python
Tim,

Cheers for the great solution!!

Your code gives me an easy to parse string containing the same serial
number as reported by USBDeview.exe.

Thank you very much,
Malcolm



Try using Win32_DiskDrive instead. I'm not 100% sure (read: I'm 
about 1% sure) what constitutes the USB serial number. The only
thing I'm fairly sure about is that it's *not* the volume label.

The PNPDeviceID looks good, even if it might need a bit of parsing:


import wmi

c = wmi.WMI ()
for usb in c.Win32_DiskDrive (InterfaceType="USB"):
  print usb.PNPDeviceID




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


[python-win32] Create a QueryInfo type Windows Shell Extension to provide InfoTip data in Windows Explorer

2010-01-04 Thread python
Wondering if its possible to create Windows Shell Extensions
using pywin32 and if so, has anyone has tried to create a
QueryInfo type Windows Shell Extension?

I would like to create a Python equivalent of the simple InfoTip
described in this well written tutorial.
http://www.codeproject.com/KB/shell/shellextguide3.aspx

Here's a quick excerpt from this article:

Quote:

The Active Desktop shell introduced a new feature: tooltips that
show a description of certain objects if you hover the mouse over
them. For example, hovering over My Documents shows this tooltip:

[My Computer tooltip - 6K]

Other objects like My Computer and Control Panel have similar
tooltips. These bits of text are called infotips, since they are
tooltips that provide information about the file, folder, or
object that the mouse is over. We can provide our own infotip
text for other objects in the shell, using an infotip extension.
An example of an infotip extension that you have probably already
seen is in WinZip, which shows the contents of compressed files:

[WinZip tooltip - 5K]

This article's sample extension will be a quick text file viewer
- it will display the first line of the file, along with the
total file size. This information will appear in an infotip when
the user hovers the mouse over a .TXT file.
Extracting the info I want to display in an InfoTIp is easy :)
... its the plumbing to support the display of information that
has me stuck.

Thank you,
Malcolm
_______
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32


[python-win32] Detect when application is running in a VM environment?

2010-03-03 Thread python
Looking for ideas on how to detect when our Windows application
is running in one of the following VM environments. Some starter
ideas for detection are in parentheses. There may be (much)
better detection techniques - the starter ideas I've come up with
are based on my Google research.

- VMWare (looking for the presence of optional VMware Tools is
one way)
- Microsoft Virtual PC (have a device named "Virtual HD" for
their IDE disks, "MS Virtual SCSI Disk Device" for their SCSI
disks)
- Citrix Xen
- Sun Virtual Box

Any suggestions?

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


[python-win32] WMI script that shows general info about a computer

2010-03-03 Thread python
Apologies for the vague description. I'm looking for tips on a
WMI query that would allow me to show general info about a
computer.

We're going to use this data as part of a workstation inventory
project I'm working on.

I'm sure I've seen this type of query before but my google-mojo
is failing me.

Thank you,
Malcolm
_______
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32


Re: [python-win32] Detect when application is running in a VM environment?

2010-03-03 Thread python
Hi Tim,

>> Looking for ideas on how to detect when our Windows application is
>> running in one of the following VM environments.

> Why? Is this for curiousity, or is it a lame-brained security scheme?

LOL! No, I'm working on a script that inventories all the environments
we're running in our development labs. With virtualization, we have lots
of new environments popping up all over the place - most of which are
intended as temporary test environments - that have the unfortunate side
effect of hanging around a lot longer than we had hoped.

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


Re: [python-win32] WMI script that shows general info about a computer (SOLVED)

2010-03-03 Thread python
OP here. When in doubt, read the (very well commented) wmi.py
source code :)

computerSystem = wmi.WMI().Win32_ComputerSystem()[0]

Sorry for the interuption.

Malcolm

- Original message -
From: pyt...@bdurham.com
To: python-win32@python.org
Date: Wed, 03 Mar 2010 21:01:19 -0500
Subject: [python-win32] WMI script that shows general info about
a computer
Apologies for the vague description. I'm looking for tips on a
WMI query that would allow me to show general info about a
computer.

We're going to use this data as part of a workstation inventory
project I'm working on.

I'm sure I've seen this type of query before but my google-mojo
is failing me.

Thank you,
Malcolm
_______
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] How to enumerate a WMI object to discover its properties?

2010-03-03 Thread python
Is there a way to enumerate a WMI object's properties to discover
what they are vs. having to explictly reference properties by
name?

>From reading the wmi.py source code I understand that enumerating
Win32_ComputerSystem() is not a good idea. But, using that as an
example anyway, how would I get a list of WMI properties like
.TotalPhysicalMemory without having to know each property ahead
of time.

Thank you,
Malcolm
___
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32


Re: [python-win32] How to enumerate a WMI object to discover its properties?

2010-03-04 Thread python
Hi Tim,

Thanks to your help, here's what I'm using to record interesting
information about our workstation inventory. It works great!

c = wmi.WMI().Win32_ComputerSystem
computer = c()[0]
for propertyName in sorted( list( c.properties ) ):
print '%s = %s' % ( propertyName, getattr( computer,
propertyName, '' ) )

For those searching the archives, the same technique can be used to
capture BIOS info as well using the following replacement line.

c = wmi.WMI().Win32_BIOS

Thank you very much for your help and for all your Win32
contributions!!!

Cheers,
Malcolm


- Original message -
From: "Tim Golden" 
To: 
Cc: "zz Python Win32 Newsgroup" 
Date: Thu, 04 Mar 2010 08:49:28 +
Subject: Re: [python-win32] How to enumerate a WMI object to discover
its properties?

On 04/03/2010 06:38, pyt...@bdurham.com wrote:
> Is there a way to enumerate a WMI object's properties to discover
> what they are vs. having to explictly reference properties by
> name?

Assuming I understand the question, a quickie shortcut is
just to "print" the object:


import wmi

c = wmi.WMI ()
for s in c.Win32_ComputerSystem ():
   print s



but in fact each object also holds a list of its own properties:


import wmi

c = wmi.WMI ()
print list (c.Win32_ComputerSystem.properties)
print list (c.Win32_ComputerSystem.methods)

or you can do the same with an instance:

for s in c.Win32_ComputerSystem ():
   print list (s.properties)


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


Re: [python-win32] WMI script that shows general info about a computer (SOLVED)

2010-03-04 Thread python
Hi Tim,

> Well I'm always glad to hear a positive comment on the
> source code, but there *is* some documentation:
>
> http://timgolden.me.uk/python/wmi/index.html
> http://timgolden.me.uk/python/wmi/tutorial.html
> http://timgolden.me.uk/python/wmi/cookbook.html

I read and enjoyed all your documentation. The WMI feature I was trying
to find (couldn't remember the name) was Win32_ComputerSystem and I
don't believe that showed up in any of your examples. Not a criticism -
I wasn't expecting you to provide general WMI documentation.

I'm back on track thanks to your help!

Cheers,
Malcolm
_______
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32


Re: [python-win32] WMI script that shows general info about a computer (SOLVED)

2010-03-05 Thread python
Hi Tim,

> Something else which might help, then, is the wmiweb.py which ships with 
> recent versions of the wmi module. It installs to c:\pythonxx\scripts or you 
> can just get it here: http://svn.timgolden.me.uk/wmi/trunk/wmiweb.py

> It's a standalone web app which lets you browse the wmi namespaces on local 
> or remote computers. I often use it when I know there's a WMI class for 
> something but I can't remember exactly what it's called :)

WOW!!! I had that on my workstation and didn't even know about it.

I just took a look and was blown away. Very nicely done. And very, very
helpful!!!

THANK YOU TIM!

Cheers,
Malcolm
_______
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32


[python-win32] Detect whether a workstation is a laptop or desktop/server?

2010-03-05 Thread python
As part of an inventory project I'm working on, I'm trying to
figure out whether a specific computer is a mobile asset (laptop)
or fixed asset (desktop/server).

Is there some feature that I can look that would indicate whether
a computer is a laptop or not? My initial thought was I could
look for battery properties, but I'm not sure that would allow me
to distinguish between a laptop and a server with an attached
UPS.

Any suggestions?

Thank you,
Malcolm
___
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32


Re: [python-win32] Detect whether a workstation is a laptop or desktop/server?

2010-03-06 Thread python
Hi Roberto. 

> I assume you could categorize a computer as a laptop or desktop once you knew 
> the machine's make an model.  

Unfortunately, we're a start-up company with an entirely random mix of
computers from what seems like every vendor possible. I'm not sure where
I would find a database for some of the machines we have.

I'm hoping that there's a WMI property that allows me to distinguish
between a laptop battery and an external UPS. (I've been looking, but my
google-fu is failing me).

Thanks for your help,

Regards,
Malcolm
_______
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32


Re: [python-win32] Detect whether a workstation is a laptop or desktop/server?

2010-03-06 Thread python
Steve,

Those are some great ideas! I'll give it a shot and see what
works for us.

Thanks for your help,

Malcolm



- Original message -
From: "Steven James" 
To: python-win32@python.org
Date: Sat, 6 Mar 2010 10:17:43 -0500
Subject: Re: [python-win32] Detect whether a workstation is a
laptop or desktop/server?
Not sure exactly, but perhaps you could distinguish whether the
battery is connected via USB or some other transport method?
Looking through the device manager there seem to be some fields
that might be relevant. As a network admin, I've used a free
software called Spiceworks in the past that scans our network and
classifies machines. Does a decent job and seems to use the
model-database technique.
Other ways might be...does the machine have a PCMCIA slot? does
it have built-in wifi/bluetooth? A 5400RPM hard drive? These
aren't assurances, but they point to laptops.
Well I think that's every way possible of not answering your
question. Sorry =).
SJ
On Sat, Mar 6, 2010 at 10:00 AM, <[1]pyt...@bdurham.com> wrote:

  Hi Roberto.
  > I assume you could categorize a computer as a laptop or
  desktop once you knew the machine's make an model.
  Unfortunately, we're a start-up company with an entirely
  random mix of
  computers from what seems like every vendor possible. I'm not
  sure where
  I would find a database for some of the machines we have.
  I'm hoping that there's a WMI property that allows me to
  distinguish
  between a laptop battery and an external UPS. (I've been
  looking, but my
  google-fu is failing me).
  Thanks for your help,
  Regards,
  Malcolm
  ___
  python-win32 mailing list
  [2]python-wi...@python.org
  [3]http://mail.python.org/mailman/listinfo/python-win32

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

References

1. mailto:pyt...@bdurham.com
2. mailto:python-win32@python.org
3. 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] Detect whether a workstation is a laptop or desktop/server?

2010-03-07 Thread python
Preston, Tony, and Steven,

I found the following WMI class which sounds like it might be
useful.

Determine whether a computer is a tower, a mini-tower, a laptop,
and so on by using the Win32_SystemEnclosure class and checking
the value of the ChassisType property.

http://msdn.microsoft.com/en-us/library/aa394587%28VS.85%29.aspx

Oddly enough, this function indicates that my laptop (new Sony
Vaio running Windows 7 Professional (64-bit) has no enclosure. :)

Well, its a start!

Thank you all for your ideas and help!

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


[python-win32] Trying to get the Win32_PortableBattery and Win32_SystemEnclosure classes to work

2010-03-07 Thread python
I'm trying to get the Win32_PortableBattery and
Win32_SystemEnclosure classes to work.

Oddly enough, both classes return empty results on my laptop. I'm
wondering if I'm using the WMI interface correctly or if I need
to be more explict in the arguments I pass to each class's
__init__?

Here are my results from Python 2.6.4 (32-bit) run on a Sony Vaio
laptop with Windows 7 Professional (64-bit):

>>> import wmi
>>> c = wmi.WMI().Win32_SystemEnclosure
>>> c
<_wmi_class: \\SONYLAPTOP-01\ROOT\cimv2:Win32_SystemEnclosure>

>>> c()
[<_wmi_object:
\\SONYLAPTOP-01\root\cimv2:Win32_SystemEnclosure.Tag="System
Enclosure 0">]

>>> c()[0]
<_wmi_object:
\\SONYLAPTOP-01\root\cimv2:Win32_SystemEnclosure.Tag="System
Enclosure 0">
>>> c()[0].properties
{u'HotSwappable': None, u'SKU': None, u'SerialNumber': None,
u'Width': None, u'SecurityBreach': None, u'Removable': None,
u'PartNumber': None, u'AudibleAlarm': None, u'Status': None,
u'TypeDescriptions': None, u'Description': None,
u'NumberOfPowerCords': None, u'Replaceable': None,
u'LockPresent': None, u'SecurityStatus': None,
u'BreachDescription': None, u'Manufacturer': None,
u'OtherIdentifyingInfo': None, u'Version': None, u'Name': None,
u'InstallDate': None, u'ServiceDescriptions': None,
u'VisibleAlarm': None, u'PoweredOn': None, u'ServicePhilosophy':
None, u'SMBIOSAssetTag': None, u'Caption': None, u'Depth': None,
u'Model': None, u'HeatGeneration': None, u'Weight': None,
u'ChassisTypes': None, u'Height': None, u'Tag': None,
u'CableManagementStrategy': None, u'CreationClassName': None,
u'CurrentRequiredOrProduced': None}

-AND-

>>> c = wmi.WMI().Win32_PortableBattery
>>> c
<_wmi_class: \\SONYLAPTOP-01\ROOT\cimv2:Win32_PortableBattery>

>>> c()
[]

>>> c.properties
{u'BatteryStatus': None, u'PowerManagementSupported': None,
u'ManufactureDate': None, u'MaxRechargeTime': None,
u'SystemName': None, u'Location': None, u'CapacityMultiplier':
None, u'Status': None, u'TimeToFullCharge': None, u'PNPDeviceID':
None, u'Description': None, u'ConfigManagerUserConfig': None,
u'ErrorCleared': None, u'MaxBatteryError': None, u'Manufacturer':
None, u'Name': None, u'InstallDate': None, u'DesignVoltage':
None, u'EstimatedChargeRemaining': None, u'Caption': None,
u'StatusInfo': None, u'DeviceID': None,
u'ConfigManagerErrorCode': None, u'PowerManagementCapabilities':
None, u'Chemistry': None, u'TimeOnBattery': None,
u'ExpectedLife': None, u'DesignCapacity': None,
u'SmartBatteryVersion': None, u'ErrorDescription': None,
u'Availability': None, u'LastErrorCode': None,
u'CreationClassName': None, u'EstimatedRunTime': None,
u'FullChargeCapacity': None, u'SystemCreationClassName': None}

BTW: I get similar (empty) results when I run the equivalent
non-wmi module code (win32com.client based) for the above WMI
classes from the following script collection:

http://www.thescriptlibrary.com/Default.asp?Action=Browse&Level=C
ategory2&ScriptLanguage=Python&Category1=Scriptomatic&Category2=C
IMV2

Any suggestions appreciated.

Thank you,
Malcolm
___
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32


Re: [python-win32] Trying to get the Win32_PortableBattery and Win32_SystemEnclosure classes to work

2010-03-08 Thread python
Hi Tim,

> It looks like you're a little bit confused as to what's going on here. (Or 
> maybe I am :) ).

No, I'm definitely the one that's confused! :)

> Although you *can*, you won't normally use the class as an object in its own 
> right. But maybe you were just checking that you'd got the right thing.

I was checking that I got the right thing - for purposes of documenting
my question on this forum.

>>>> c()[0].properties
> {u'HotSwappable': None, u'SKU': None, u'SerialNumber': None,
> u'Width': None, u'SecurityBreach': None, u'Removable': None,
> u'PartNumber': None, u'AudibleAlarm': None, u'Status': None,
> u'TypeDescriptions': None, u'Description': None,
> u'NumberOfPowerCords': None, u'Replaceable': None,
> u'LockPresent': None, u'SecurityStatus': None,
> u'BreachDescription': None, u'Manufacturer': None,
> u'OtherIdentifyingInfo': None, u'Version': None, u'Name': None,
> u'InstallDate': None, u'ServiceDescriptions': None,
> u'VisibleAlarm': None, u'PoweredOn': None, u'ServicePhilosophy':
> None, u'SMBIOSAssetTag': None, u'Caption': None, u'Depth': None,
> u'Model': None, u'HeatGeneration': None, u'Weight': None,
> u'ChassisTypes': None, u'Height': None, u'Tag': None,
> u'CableManagementStrategy': None, u'CreationClassName': None,
> u'CurrentRequiredOrProduced': None}

> OK. Now you're looking at the behind-the-scenes properties cache. Which 
> doesn't have anything in it yet because you haven't requested any properties. 
> Try this instead:
> Do you still get no values?

Now I see what I was doing wrong. Your code example explains it
perfectly.

Works perfectly for me with the ***c.Win32_SystemEnclosure class***.

> And likewise for the battery class

No. The battery class appears to really return no information.

Here's my updated battery code:

import wmi

c = wmi.WMI()
for battery in c.Win32_PortableBattery():
print battery

This code doesn't output anything.

Here's a step-by-step from IDLE:

>>> c = wmi.WMI().Win32_PortableBattery
>>> c
<_wmi_class: \\SONYLAPTOP-01\ROOT\cimv2:Win32_PortableBattery>

>>> c()
[] <- empty list 

I'm testing this on a 2009 Sony Vaio laptop (notebook with a built-in
battery) running Windows 7 Professional (64-bit).

I'm positive I have a battery and that this battery works.

Thanks again for your help on this thread.

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


Re: [python-win32] [Correction] Trying to get the Win32_PortableBattery and Win32_SystemEnclosure classes to work

2010-03-08 Thread python
Tim,

The problem with Win32_PortableBattery appears to be that I need to use
Win32_Battery instead.

Using the latter, everything works as expected.

I'm not entirely clear on why there are 2 battery classes and why I
would choose to use vs. the other, but I suspect the
Win32_PortableBattery class is for machines with advanced power supply
management capabilities.

Thank you for your help!

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


Re: [python-win32] [Correction] Trying to get the Win32_PortableBattery and Win32_SystemEnclosure classes to work

2010-03-08 Thread python
>> I suspect the win32_PortableBattery class is for machines with advanced 
>> power supply management capabilities.

> Obviously it's for machines that have a *wireless* battery.

:)

Now you tell me!

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


[python-win32] Technique to limit number of instances of our application under Terminal Server

2010-03-09 Thread python
I'm looking for simple ways to monitor and limit the number of
instances of our Python application that gets run on our in-house
Terminal Servers (2003 and 2008).
The purpose of this restriction is to make sure we don't overload
our servers. This is an internal administrative requirement - I
am not looking for a licensing solution.
Background: The application in question is written in Python 2.6
(32-bit). Our Terminal Server environments are used for testing
and it is not uncommon for the test builds of our application to
lock up or abort abnormally. Please consider these non-typical
circumstances when suggesting a solution :)

Thank you,
Malcolm
_______
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32


Re: [python-win32] Technique to limit number of instances of our application under Terminal Server

2010-03-10 Thread python
Hi Tim,

> It's not quite clear whether you want something which you can build into the 
> application itself 

Yes, since I control the source code, this is a feature I would like to
build into my applications.

> ... in which case, the answer's probably Semaphores:
> http://msdn.microsoft.com/en-us/library/ms685129%28VS.85%29.aspx

Thanks for that link. My understanding is that semaphores only to apply
to threads within a single running application?

On the other hand, perhaps the term 'threads' applies to applications as
well? I say that because the term thread is used to describe mutex's
which I've used on a program vs. thread basis.

Microsoft's description of Mutex's
http://msdn.microsoft.com/en-us/library/ms684266%28VS.85%29.aspx

My research on semaphors also leads me to believe that if an application
incremented a semaphor and crashed without decrementing the semaphore,
then my semaphore count would be incorrect. Since the code in question
is being run in a test environment, the possibility of abnormal
terminations is higher than one would normally expect. Does this sound
accurate to you?

> Obviously there are other approaches: you could write transient pid files in 
> the Unix fashion, you could use Job objects to group your processes together 
> in one job:
http://msdn.microsoft.com/en-us/library/ms684161%28VS.85%29.aspx

What are your thoughts on using a pre-assigned list of mutexes. An
application would walk a list of named mutex's trying to lock one for
itself. If an application iterated through a list of mutex's without
securing one for itself, it would exit.

The advantage of mutex's over semaphores would be that applications that
terminate abnormally would have their mutex released, while applications
using semaphors that terminated abnormally would leave their semaphore
with an incorrect count?

The disadvantage of using mutex's vs. semaphores is that the time to
find a free mutex might be much slower than the time to simply increment
or decrement a semaphor.

On the other hand, one of my colleagues claims that neither semphores or
mutuxes will be visible to other Terminal Service users. In other words,
all I will be able to do with semaphores and mutex's is to make sure a
SPECIFIC user doesn't run an application more than once.  Put another
way, there may be no such thing as Global (that are visible across user
sessions) semaphores and mutex's.

So I'm back to thinking about your PID file idea :)

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


Re: [python-win32] Technique to limit number of instances of our application under Terminal Server

2010-03-12 Thread python
Greg,

Very clever! Thank you,

Malcolm


- Original message -
From: "Greg Ewing" 
To: "zz Python Win32 Newsgroup" 
Date: Sat, 13 Mar 2010 00:15:19 +1300
Subject: Re: [python-win32] Technique to limit number of instances of
our application under Terminal Server

Here's another possible solution. Each process tries to open a
socket connection to a server process. When the maximum number of
processes are connected, the server stops accepting connections.

The server also selects all of its open connections for reading.
When a process dies, the server will notice because it will
see an EOF condition on its connection.

-- 
Greg

_______
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] Technique to limit number of instances of our application under Terminal Server

2010-03-12 Thread python
Hi Mark,

> It sounds like you are after a named semaphore in the "Global\\" 
namespace.  The semaphore count should work fine when your process 
terminates abnormally ...

Thanks for your help. I'm experimenting with the semaphore concept
and I think its possible for my semaphore counts to fall out of
sync in certain situations.

In a perfect world, semaphores look like a great solution, but
I may need to fall back to my idea of a collection of mutex's.
Admittedly this is an awkward solution, but mutex's seem to be a 
very reliable way to determine whether a process is holding a 
resource or not, eg. they consistently get released when a 
process terminates abnormally.


- Original message -
From: "Mark Hammond" 
To: pyt...@bdurham.com
Cc: "Tim Golden" , "zz Python Win32 Newsgroup"

Date: Thu, 11 Mar 2010 12:52:43 +1100
Subject: Re: [python-win32] Technique to limit number of instances of
our application under Terminal Server

It sounds like you are after a named semaphore in the "Global\\" 
namespace.  The semaphore count should work fine when your process 
terminates abnormally - but will not if it simply hangs - so something 
will need to terminate a hung process before the semaphore becomes 
available.

HTH,

Mark

On 11/03/2010 8:16 AM, pyt...@bdurham.com wrote:
> Hi Tim,
>
>> It's not quite clear whether you want something which you can build into the 
>> application itself
>
> Yes, since I control the source code, this is a feature I would like to
> build into my applications.
>
>> ... in which case, the answer's probably Semaphores:
>> http://msdn.microsoft.com/en-us/library/ms685129%28VS.85%29.aspx
>
> Thanks for that link. My understanding is that semaphores only to apply
> to threads within a single running application?
>
> On the other hand, perhaps the term 'threads' applies to applications as
> well? I say that because the term thread is used to describe mutex's
> which I've used on a program vs. thread basis.
>
> Microsoft's description of Mutex's
> http://msdn.microsoft.com/en-us/library/ms684266%28VS.85%29.aspx
>
> My research on semaphors also leads me to believe that if an application
> incremented a semaphor and crashed without decrementing the semaphore,
> then my semaphore count would be incorrect. Since the code in question
> is being run in a test environment, the possibility of abnormal
> terminations is higher than one would normally expect. Does this sound
> accurate to you?
>
>> Obviously there are other approaches: you could write transient pid files in 
>> the Unix fashion, you could use Job objects to group your processes together 
>> in one job:
> http://msdn.microsoft.com/en-us/library/ms684161%28VS.85%29.aspx
>
> What are your thoughts on using a pre-assigned list of mutexes. An
> application would walk a list of named mutex's trying to lock one for
> itself. If an application iterated through a list of mutex's without
> securing one for itself, it would exit.
>
> The advantage of mutex's over semaphores would be that applications that
> terminate abnormally would have their mutex released, while applications
> using semaphors that terminated abnormally would leave their semaphore
> with an incorrect count?
>
> The disadvantage of using mutex's vs. semaphores is that the time to
> find a free mutex might be much slower than the time to simply increment
> or decrement a semaphor.
>
> On the other hand, one of my colleagues claims that neither semphores or
> mutuxes will be visible to other Terminal Service users. In other words,
> all I will be able to do with semaphores and mutex's is to make sure a
> SPECIFIC user doesn't run an application more than once.  Put another
> way, there may be no such thing as Global (that are visible across user
> sessions) semaphores and mutex's.
>
> So I'm back to thinking about your PID file idea :)
>
> Regards,
> Malcolm
> ___
> 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] Technique to limit number of instances of our application under Terminal Server

2010-03-12 Thread python
Hi Link,

> If the limit is one, then a lazy and dirty way is to bind to a tcp 
port (just pick a fixed one that's not used by other services - you 
could make it configurable), and exit if the bind fails.

An excellent idea. I'm leaning towards either this idea or a
collection of mutexes.

Thanks for your feedback,

Mal

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


Re: [python-win32] Technique to limit number of instances of our application under Terminal Server

2010-03-12 Thread python
Tim,

Thank you for your example code and ideas!!

I think my earlier experiments with semaphores may be the result of my
poor code vs. your approach :)

I'm going to put aside my pool of mutex's idea and experiment with your
sample code.

Regards,
Malcolm


- Original message -
From: "Tim Golden" 
To: 
Cc: "zz Python Win32 Newsgroup" 
Date: Thu, 11 Mar 2010 15:31:22 +
Subject: Re: [python-win32] Technique to limit number of instances of
our application under Terminal Server

On 10/03/2010 21:16, pyt...@bdurham.com wrote:
> Hi Tim,
>
>> It's not quite clear whether you want something which you can build into the 
>> application itself
>
> Yes, since I control the source code, this is a feature I would like to
> build into my applications.
>
>> ... in which case, the answer's probably Semaphores:
>> http://msdn.microsoft.com/en-us/library/ms685129%28VS.85%29.aspx
>
> Thanks for that link. My understanding is that semaphores only to apply
> to threads within a single running application?

You can use semaphores (and mutexes, which are basically semaphores with
a count of one) cross-process by naming them:


import time
import win32event

s1 = win32event.CreateSemaphore (None, 4, 4, u"tims-app")
try:
   win32event.WaitForSingleObject (s1, -1)
   time.sleep (10)
finally:
   win32event.ReleaseSemaphore (s1, 1)



If you run this micro-app in five separate windows, the fifth
edition will block until one of the others completes. If you're
using terminal services, you'll have to use the "global\" prefix
to the name to allow it to be seen by other TS sessions.

Note that the pywin32 docs for CreateSemaphore are wrong; I think
they're a hybrid of the CreateEvent and CreateSemaphore signature.
Follow the ms docs literally as I do above and you're fine.

> My research on semaphors also leads me to believe that if an application
> incremented a semaphor and crashed without decrementing the semaphore,
> then my semaphore count would be incorrect.

I think you're ok if you crash. Either the finally: clause above
will take care of things or -- I imagine, altho' I don't know
for sure -- the process will release all its handles when it dies,
including its semaphore.

> What are your thoughts on using a pre-assigned list of mutexes. An
> application would walk a list of named mutex's trying to lock one for
> itself. If an application iterated through a list of mutex's without
> securing one for itself, it would exit.

I think this is to some extent re-inventing semaphores with a homebrew
numbering system.

> The advantage of mutex's over semaphores would be that applications that
> terminate abnormally would have their mutex released, while applications
> using semaphors that terminated abnormally would leave their semaphore
> with an incorrect count?

See above; I don't this mutexes and semaphores differ in this respect.


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] Technique to limit number of instances of our application under Terminal Server

2010-03-12 Thread python
Hi Christopher,

Thanks for your thoughts. I'm going to go back and re-test the
semaphor strategy using Tim's sample code.

My situation is very unusual in that the apps being run are often
buggy because they are early releases of software being tested by
a small team of testers. Our test team seems to test on a random
schedule (of course they would argue otherwise!) which means
there are spikes in demand on our server. The code I'm trying to
write doesn't need to be perfect - it just needs to be good
enough to protect us from ourselves :)

On the other hand, you might be suprised how many times our apps
get abnormally terminated so we do need a fairly accurate way to
track running instances or the entire process is not worth
pursuing.

Regards,
Malcolm


- Original message -
From: "Christopher Nilsson" 
To: "Tim Golden" 
Cc: "zz Python Win32 Newsgroup" 
Date: Fri, 12 Mar 2010 12:38:29 +1100
Subject: Re: [python-win32] Technique to limit number of
instances of our application under Terminal Server
Hi all,
On 12 March 2010 02:31, Tim Golden <[1]m...@timgolden.me.uk>
wrote:

  The advantage of mutex's over semaphores would be that
  applications that
  terminate abnormally would have their mutex released, while
  applications
  using semaphors that terminated abnormally would leave their
  semaphore
  with an incorrect count?

  See above; I don't this mutexes and semaphores differ in this
  respect.

Actually, if you take the example of someone calling
TerminateProcess() against the process (or some other equally
fatal do-not-pass-the-finally-block abnormal exits), they will be
different.
In this case, a mutex will be unlocked, and another process'
waiting thread will get a WAIT_ABANDONED wake up.
For semaphores, the handles will be mopped up, but the available
count on that semaphore will not be incremented.  So if you've
got lots of other processes coming and being killed in this way,
you can easily run out of slots, even though there is only one
handle open on the thing.
It's a pity, since the semaphore way of doing this is much
cleaner and faster than the "bunch of mutexes" method.
If you've got some other way to guarantee that you'll see such
processes vanish (eg. grab a SYNCHRONIZE handle on it via
OpenProcess() -- these will get signalled when the process dies
normally or abnormally), then it's still workable, since you can
then call ReleaseSemaphore() yourself -- without having to wait
for the original holder to do it.  But now you've got two
problems (limit instances *and* notice when they die). :)
Or, maybe it's an acceptable risk.  How badly do you want to
fight TerminateProcess / death by Task Manager anyway?  And you
could argue that other kinds of abnormal explosions are bugs that
need fixing.  My vote would definitely be for the semaphore
method.
Cheers,
Chris.
_______
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32

References

1. mailto:m...@timgolden.me.uk
_______
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32


Re: [python-win32] Technique to limit number of instances of our application under Terminal Server

2010-03-12 Thread python
Hi Tim,

Before continuing I want to express how grateful I am to you and all the
others that have joined this thread. THANK-YOU, THANK-YOU, THANK-YOU!

> Be aware of Christopher Nilsson's point that while the Mutex will be released 
> if the holding process crashes hard, the Semaphore will not release its 
> token. (Haven't tried this myself; I'm assuming he's had experience or has 
> read the docs more carefully than me).

This is actually what I saw, too, but thought it was a subtle problem
with how I coded my tests.

> The bind-to-a-socket approach is a good general-purpose solution. (It can be 
> used on any socket-based system where binding semantics disallow simultaneous 
> connections).

I like this idea (and Windows seems to disallow simultaneous
connections), but at a high level, I'm not sure how managing a pool of
sockets is any different than managing a pool of mutex's? I haven't
tried it yet, but intuitively I would think that a pool of mutex's would
be faster to iterate through and more resource efficient?

Regards,
Malcolm

- Original message -
From: "Tim Golden" 
To: 
Cc: "zz Python Win32 Newsgroup" 
Date: Fri, 12 Mar 2010 14:31:54 +
Subject: Re: [python-win32] Technique to limit number of instances of
our application under Terminal Server

On 12/03/2010 14:21, pyt...@bdurham.com wrote:
> Tim,
>
> Thank you for your example code and ideas!!
>
> I think my earlier experiments with semaphores may be the result of my
> poor code vs. your approach :)
>
> I'm going to put aside my pool of mutex's idea and experiment with your
> sample code.

Good luck. Be aware of Christopher Nilsson's point that while
the Mutex will be released if the holding process crashes hard,
the Semaphore will not release its token. (Haven't tried this
myself; I'm assuming he's had experience or has read the docs
more carefully than me).

The bind-to-a-socket approach is a good general-purpose solution.
(It can be used on any socket-based system where binding semantics
disallow simultaneous connections).

Greg Ewing's "control server" is the kind of thing you'd be doing
for license control, eg, and has the advantage he points out about
detecting dead session. But it has the overhead of a control process.
Which may or may not be an issue for you.

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] Python Windows Socket problem after Py2exe and install

2010-03-13 Thread python
> Are any of your imports buried inside "if" or "def" statements? py2exe uses a 
> module-finding technique that doesn't work with those, and you'll either need 
> to change your code or list the modules in setup.py

We have import's embedded in 'if' blocks and py2exe seems to be picking
these up fine.

We also have some applications that were making some dynamic imports
that py2exe naturally wouldn't know about. We solved this problem by
making sure we included almost all the modules's in python's standard
library ('the kitchen sink strategy'). We did this by placing a huge
list of imports inside a 'if False:' block.

Our strategy for deciding what modules to include (import) in our py2exe
project is detailed in my Mar 9 post to this forum titled 'Choosing a
collection of common modules/packages for a general purpose reusable
PY2EXE runtime'. This post got zero feedback so our idea is either too
stupid or too obvious to warrant further conversation :)

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


Re: [python-win32] Python Windows Socket problem after Py2exe and install

2010-03-13 Thread python
Tom,

> You don't need to add a whole load of imports inside a "if
False" block to make py2exe add them. If I recall correctly there
is a option in py2exe to force exclude and include modules when
compiling.

 DOH! You're right! 

I've been doing a lot of work with our automated build cycle and
I must have looked at 100 different setup.py's. We do use these
features to fine tune our py2exe setup scripts for each
application. We just missed using these features for forcing our
large 'standard library (kitchen sink)' collection of modules.

Good catch!

Thank you,
Malcolm
_______
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32


Re: [python-win32] MAPI with win32com

2010-03-22 Thread python
Werner,

I'm not sure I understand the benefit of being locked into the
proprietary and awkward MAPI protocol?

Why can't you use industry standard SMTP to send your messages? Simpler
and more portable.

Malcolm


- Original message -
From: "Werner F. Bruhin" 
To: python-win32@python.org
Date: Mon, 22 Mar 2010 13:40:52 +0100
Subject: Re: [python-win32] MAPI with win32com

Tim,

Thanks for the quick response.

On 22/03/2010 12:26, Tim Golden wrote:
> On 22/03/2010 11:22, Werner F. Bruhin wrote:
>> On 22/03/2010 12:06, Werner F. Bruhin wrote:
>>> I am trying to use MAPI to send an email using win32com, but I get the
>>> following exception.
>>>
>>> from win32com.client import Dispatch
>>> s = Dispatch("Mapi.Session")
>>> Traceback (most recent call last):
>>> File "", line 1, in
>>> File "C:\Python25\lib\site-packages\win32com\client\__init__.py", line
>>> 95, in Dispatch
>>> dispatch, userName =
>>> dynamic._GetGoodDispatchAndUserName(dispatch,userName,clsctx)
>>> File "C:\Python25\lib\site-packages\win32com\client\dynamic.py", line
>>> 98, in _GetGoodDispatchAndUserName
>>> return (_GetGoodDispatch(IDispatch, clsctx), userName)
>>> File "C:\Python25\lib\site-packages\win32com\client\dynamic.py", line
>>> 78, in _GetGoodDispatch
>>> IDispatch = pythoncom.CoCreateInstance(IDispatch, None, clsctx,
>>> pythoncom.IID_IDispatch)
>>> com_error: (-2147221005, 'Cha\xeene de classe incorrecte', None, None)
>>>
>>> I first tried this having Thunderbird as my MAPI client, then installed
>>> Windows Live Email (I want to test MAPI with one of the "newer" MS Mail
>>> clients) and defined it as the MAPI client (Default Programs - MAPI),
>>> still same result.
>>>
>>> Any hints on what I am doing wrong here would be very much welcomed.
>>>
>>> I am on Windows 7, Python 2.5.4, py2in32 build 210.
>>>
>>> Werner
>> Just came accross Tim Golden's site
>> (http://timgolden.me.uk/python/win32_how_do_i/read-my-outlook-inbox.html)
>> and
>> tried this:
>>
>> session = win32com.client.gencache.EnsureDispatch ("MAPI.Session")
>>
>> But I do get the same exception.
>
> Have a look at:
>
> http://kb.mozillazine.org/MAPI_Support
>
> which explains that TB (like OE) only supports "Simple MAPI". There's
> a whole confusion of terminology around this area, but I'm afraid that
> the bottom line is: the only client which really supports CDO, ie
> MAPI.Session
> is the full Outlook client. It's just about possible to use CDO without
> installing Outlook (by installing some standalone package whose name
> escapes me)
I found this:
http://www.microsoft.com/downloads/details.aspx?FamilyID=E17E7F31-079A-43A9-BFF2-0A110307611E&displaylang=en

At least I get past the above error, will see how far I get with this.
  but that still only gives you access to Exchange, not to
> whatever interface TB exposes.
Clients and me using TB are fine, I support that with the simplemapi.py 
(http://www.johnnypops.demon.co.uk/python/simplemapi.py) and it works 
fine, but clients who use Outlook (e.g. Office 11) get a MAPI error 2 
(failure).
>
> TJG

I don't want to use Outlook, but I like to provide an additional way of 
sending problem reports from within my application to me (MAPI, 
smtplib), so hoped that I could use extended MAPI stuff.

I guess I just have to get my hands onto an Outlook to be able to test 
this stuff.


Werner

___
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] MAPI with win32com

2010-03-22 Thread python
Werner,

> I do offer the SMTP option using smtplib which works great, but some 
clients don't know/like to fill in the configuration stuff needed and 
others really want to see in their email client of choice the email to 
go out and it also gives them the record/archive of what has been sent.

We solved the configuration issues by posting to a PHP form that in turn
sends out our emails.

We solved the record/archive concern by bcc-ing the customer's email
with a copy of what was being sent.

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


[python-win32] Win API call to display a BMP/PNG file as a splash screen for a console app?

2010-03-22 Thread python
Is there a Windows API call I can use to display a BMP or a PNG
file in a window centered on a user's display? This function
would be called from a console app to display a splash screen.

Motivation: I would like some of our customer facing Python
console utilities to display a splash screen. I don't need the
complexity of a full GUI framework like wxPython or pyQT and
hopefully I can avoid the need to use a full library like PIL.

Thank you,
Malcolm
_______
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32


Re: [python-win32] Win API call to display a BMP/PNG file as a splash screen for a console app?

2010-03-22 Thread python
Hi Tony,

Thanks for the wxPython code. My reason for wanting to avoid
wxPython (and pyQt) is that I don't want to ship the wxPython
framework just to display a splash screen. I believe this might
triple the size of my PY2EXE generated executables - not a
worthwhile tradeoff for a cosmetic feature like a splash screen.

Regards,
Malcolm

- Original message -
From: "Tony Cappellini" 
To: python-win32@python.org
Cc: pyt...@bdurham.com
Date: Mon, 22 Mar 2010 15:47:47 -0700
Subject: Re:Win API call to display a BMP/PNG file as a splash
screen for a console app?
From: [1]pyt...@bdurham.com
To: "zz Python Win32 Newsgroup" <[2]python-wi...@python.org>
Subject: [python-win32] Win API call to display a BMP/PNG file as
a
   splash screen for a console app?
Message-ID:
<[3]1269295703.32357.1366163...@webmail.messagingengine.com>
Content-Type: text/plain; charset="us-ascii"
>>Is there a Windows API call I can use to display a BMP or a PNG
>>file in a window centered on a user's display? This function
>>would be called from a console app to display a splash screen.
I don't know, but I suspect not.
>>complexity of a full GUI framework like wxPython or pyQT and
To do this in wxPython is approximately 10 lines of code, maybe
20 at the most.
Actually- the # of lines to do this in wxPython is less than your
original email.
class SketchApp(wx.App):
def OnInit(self):
bmp = wx.Image("splash.png").ConvertToBitmap()
wx.SplashScreen(bmp, wx.SPLASH_CENTRE_ON_SCREEN |
wx.SPLASH_TIMEOUT,
1000, None, -1)
wx.Yield()
frame = SketchFrame(None)
frame.Show(True)
self.SetTopWindow(frame)
return True
if __name__ == '__main__':
app = SketchApp(False)
app.MainLoop()
This is barebones, taken from wxPython In Action- ideally you
should have some minimal exception handling
to make your app more robust.

References

1. mailto:pyt...@bdurham.com
2. mailto:python-win32@python.org
3. mailto:1269295703.32357.1366163...@webmail.messagingengine.com
___
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32


[python-win32] Detect OS shutdown or user logout

2010-04-26 Thread python
Any suggestions on how I can have a Python script detect when its
operating system is shutting down or a user is logging out?

The script in question is a local web server (based on CherryPy).

Thank you,
Malcolm
___
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32


Re: [python-win32] ide for python 3.x

2010-05-17 Thread python
Vineet,

> > Till now, I have been programming with VFP & MySQL.

Check out dabodev.org.

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


[python-win32] Creating a list of stress tests for unit tests involving files

2010-06-09 Thread python
I'm working on a set of unit tests designed to stress test some
file handling capabilities of our application.

Listed below are some file names designed to cause failures when
used with open/codecs.open and with the os/shutil module file
functions. Can anyone think of additional scenarios (path names
or unusual file access) that we could test against? My tests will
initially be for the Windows platform (2000-Windows 7), but I
would welcome Linux and/or Mac specific failure conditions as
well.

UNITTEST_DRIVE_NOT_READY = r'a:'
UNITTEST_DRIVE_READ_ONLY = r'g:'  # CD drive with CD
UNITTEST_UNC_NOT_EXIST   = r'\\unc_not_exist'
UNITTEST_FILE_BAD_CHARS  = r'path_bad_chars_*<>|'
UNITTEST_FILE_NO_WRITE  = r'c:\program files'
UNITTEST_FILE_NOT_EXIST  = r'\path_not_exist'
UNITTEST_FILE_LOCKED = r'file_locked.tmp'
unittest_file_locked = open( UNITTEST_FILE_LOCKED, 'w' )
UNITTEST_UNICODE_PATH= ur'\xunicode_test_\xb0_\xb1_'

Thank you,
Malcolm
___
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32


[python-win32] Possible to update exe file properties and/or icon via the win32api library?

2010-07-26 Thread python
Is it possible to update an exe file's properties and/or icon
file via the win32api library? By exe file properties I mean the
properties typically set via a resource file when an exe file is
created. Example properties are what one would see if they right
clicked on a file in Windows Explorer and chose the Properties
dialog.

Sample exe file properties:
- product name
- product version
- product description
- copyright
- exe icon
Use case: We have a single exe whose file properties we would
like to customize for specific customers.

An alternative question would be is there a way to update an
exe's file properties using an external resource file?

Or would I be better off finding a Windows utility that might
allow me to script exe resource file updates?

Thank you,
Malcolm
_______
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32


[python-win32] Simple Windows progressbar dialog (like messagebox) via Win32 API?

2010-09-30 Thread python
I know there is a simple interface to the Windows messagebox
interface.

Is there an equivalent type of simple dialog box for showing a
progressbar or progressbar-like information?

Use case: I have a collection of Python command line utilties
that can take up to several minutes to run. These are utilities
may be called from other applications. Our users have asked
whether these utilities can display a progressbar while they are
running.

Our utilities are very lean right now and easy to distribute and
support. We would like to avoid having to use Tkinter or large
GUI frameworks like wxPython and pyQt if at all possible.

Thank you,
Malcolm
___
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32


Re: [python-win32] Simple Windows progressbar dialog (like messagebox) via Win32 API?

2010-09-30 Thread python
Tim,

> If you look in site-packages\pythonwin\pywin\Demos, you'll find 
> "progressbar.py". This is a Python wrapper around the MFC CProgressCtrl 
> class. You might be able to adapt that to do what you need, although I'm not 
> sure MFC is any lighter weight than Tkinter.

I'm already using the Python Win32 extensions, so the progressbar.py
example might be a good fit for me.

I tested it from the command line on Windows 7 and was surprised that
the progressbar control looked like it was from Windows 95.

Any suggestions on how to have the progressbar get rendered with Themes
support? Or is this related to the use of manifest files?

Thanks for your help,

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


Re: [python-win32] Simple Windows progressbar dialog (like messagebox) via Win32 API?

2010-09-30 Thread python
Tony,

>Try Easy Dialogs 
> http://www.averdevelopment.com/python/EasyDialogs.html
>
> It has a progress bar. Easy Dialogs just wraps the native OS calls, and makes 
> them sensible & cross platform.
> 
> Using a progress bar is only a few lines of code.

Thanks for this recommendation. This looks like a great solution that's
very light weight.

I just tried this library on my Windows 7 system and was surprised to
see an old-fashioned (Windows 95 like) progressbar. Do you have any
ideas on how I might activate Theme support with this library so the
progressbar gets displayed using a Windows 7 style look?

Thanks for your help,

Malcolm

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


[python-win32] Using Win32 API to get around Tkinter limitations?

2010-10-29 Thread python
Wondering if there are ways to use the Win32 API to get around
the following Tkinter limitations?

1. Inability to set custom mouse cursors via *.cur/*.ani files.

2. Determine the height or width of window properties such as
titlebar, left/right and bottom window frame edges?

Thank you,
Malcolm
___
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32


Re: [python-win32] Using Win32 API to get around Tkinter limitations?

2010-10-29 Thread python
Eric,

The short answer (for people searching the archives) is that the
cursor='@\path\to\cursor_file.cur' technique DOES work exactly as
advertised ... when used in a script run outside of IDLE (I know,
I know ... never test Tkinter code in IDLE!).

> Did you try it?

Yes. Running Python 2.7 (32-bit) on Windows 7 (64-bit), from
within IDLE, I received the following traceback:

Traceback (most recent call last):
File "", line 1, in 
widget.config( cursor='@help.cur' )
File "C:\Python27\lib\lib-tk\Tkinter.py", line 1202, in configure
return self._configure('configure', cnf, kw)
File "C:\Python27\lib\lib-tk\Tkinter.py", line 1193, in
_configure
self.tk.call(_flatten((self._w, cmd)) + self._options(cnf))
TclError: bad cursor spec "@help.cur"

Thanks for your feedback!

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


Re: [python-win32] [Tkinter-discuss] Using Win32 API to get around Tkinter limitations?

2010-10-29 Thread python
Hi Igor,

> Why not use conventional tcl/tk functionality? It seems tcl/tk
allows to use cur/ani files for custom cursor:
> [1]http://wiki.tcl.tk/8674

Thanks for your response. You are correct, under Windows the
cursor='@path/to/file.ext' technique works as expected. I had
tried that, but from within IDLE (Python 2.7) this syntax raises
an exception. Using this technique in scripts running from the
command line (outside of IDLE) works well.

Malcolm

References

1. http://wiki.tcl.tk/8674
___
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32


[python-win32] Win32 equivalent of VB doevents() or just use time.sleep()?

2010-11-05 Thread python
We have a bunch of command line utilities that use all the CPU
capacity available to them. Our customer has asked us to find
ways we might make these utilities more system friendly by
occassionally calling what they refered to as a win32 equivalent
of VB's (Visual Basic) doevents() function.

I googled this topic and found a Mark Hammond suggestion with
qualifications[1]:

win32gui.Pump(Waiting)Messages

Is there a recommended way to run our utilities in a more CPU
friendly way? I was thinking of calling time.sleep( P ) every N
iterations through our processing but I'm not clear on the pros
and cons of this technique vs. a strategy that proactively pumps
waiting messages.

Malcolm

[1]
http://mail.python.org/pipermail/python-win32/2005-October/003920
.html
_______
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32


[python-win32] Prevent a (Tkinter) window from maximizing via win32 api call?

2010-12-02 Thread python
If I have a windows handle to my Tkinter window, is there a win32
api call that I can use that will prevent my window from being
maximized?

There is no way to prevent a resizable window from being
maximized in Tkinter other than to remove the window's border and
titlebar (both of which I would like to keep).

Thank you,
Malcolm
___
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32


Re: [python-win32] Prevent a (Tkinter) window from maximizing via win32 api call?

2010-12-02 Thread python
Hi Eric,

> Are you sure about that? I just tried:

My original question said "resizable window" :)

I have a *resizable* Tkinter window with min and max sizes set. I
want to prevent users from attempting to maximize this window
because the window pops over to the upper left of the display - a
behavior that my users find very frustrating (and of little
value).

I can trap the maximize event in Tkinter by binding to a window's
 event, but the Tkinter raises the  event
*after* it has maximized the window so I can't cancel the
maximize behavior.

Thanks for your help!

Malcolm


On 2 déc. 10, at 12:49, [1]pyt...@bdurham.com wrote:

If I have a windows handle to my Tkinter window, is there a win32
api call that I can use that will prevent my window from being
maximized?

There is no way to prevent a resizable window from being
maximized in Tkinter other than to remove the window's border and
titlebar (both of which I would like to keep).



References

1. mailto:pyt...@bdurham.com
___
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32


Re: [python-win32] DVCS options for pywin32

2011-02-07 Thread python
Mark,

I've heard very good things about github which provides free (open
source) and paid hosting plans for your projects.
https://github.com/

We're considering moving our proprietary code base to the paid version
of this service.

Cheers,
Malcolm
_______
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32


[python-win32] Detect new/changed file in a folder

2011-03-08 Thread python
I'm looking for advice on ways to have a script detect new or
changed files in a specific folder.

The easy way is to simply poll every second and to sleep between
polling cycles.

Is there a win32 technique that works from XP forward that might
be a better choice? And/or are there issues with a simple polling
technique that I should be aware of?

Thank you,
Malcolm
___
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32


Re: [python-win32] Detect new/changed file in a folder

2011-03-08 Thread python
Tim, Ben and Brian,

Thank you all for your posts - excellent information(!!!).

You have all answered my question.

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


Re: [python-win32] win32print.StartDocPrinter

2011-07-11 Thread python
Anthony,

Dabo (dabodev.com) is an open source GUI framework built on top of
wxPython.

Dabo has a very impressive report writer.

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


Re: [python-win32] manipulating service action restart behavior?

2011-08-10 Thread python
Andrew,

Thanks for sharing the solution!

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


[python-win32] Detecting user (in)activity and changing process prioritization?

2011-10-31 Thread python
Is there a way to detect user (in)activity so that a program I
have running in the background might use more system resources
when a user isn't actively using their system and when user
activity is detected, run in a more resource friendly mode?

On a related note, is it possible to change the priority of a
running process, or can the priority of a Windows process only be
set when the process is launched?

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


Re: [python-win32] Passing an object to a process

2012-03-14 Thread python
What about logging to a database?

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


[python-win32] DIR reports file timestamp and size, but os.path.getctime(), os.path.getsize() raise WindowsError [Error 5] Access is denied

2012-05-21 Thread python
Wondering if any of you have stumbled across the following
behavior:

I'm doing a recursive directory listing of my Windows folder and
I can access the timestamps and file sizes of all files except
the following 6 files:

In the \windows\microsoft.net\framework\v2.0.50727\config folder:

enterprisesec.config.cch.6824.14057640
security.config.cch.6824.14057640

In the \windows\\microsoft.net\framework64\v2.0.50727\config
folder:

\enterprisesec.config.cch.4412.14151427
enterprisesec.config.cch.6912.14056844
security.config.cch.4412.14151427
security.config.cch.6912.14056844

When I attempt to do any of the following on the above files, a
WindowsError exception is raised with a value of "[Error 5]
Access is denied: ...".

os.path.getctime()
os.path.getatime()
os.path.getmtime()
os.path.getsize()

What's strange is that the DIR command from a cmd prompt returns
timestamps and file sizes for the above files.

Background; 64-bit Windows 7; 32-bit Python 2.7.2

Any ideas on how I can retrieve timestamps and file sizes like
DIR without raising exceptions?

Thank you,
Malcolm
___
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32


Re: [python-win32] How to invoke Python program from Windows service?

2012-06-22 Thread python
>> For reference, this is the kind of pattern I use when writing Windows 
>> Services in Python:

> This is incredibly useful. Thank you.

+1

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


[python-win32] remote copy with compress/decompress

2004-12-13 Thread python
Hello,

I'm wondering if i try a good solution for the following problem:

We have an old DOS Application running on a W2K-Server which uses normal
DOS-print and a workstation(w2k) in an outlet connected to the server via VPN.
The workstation uses remote desktop to run the software and prints to LPT 1,2,3
on the server. If I redirect the servers LPT's to a lokal printer of the
workstation, printing is to slow. So I need a solution for this.

My solution is as follow:
1: capture DOS-print to file =>solved
2: compress printfile => solved

3: open a socket, transfer file to desktop
4: decompress file
step 3 and 4 is to develop a socket with python

5: print it on lokal printer => solved

What do you think about it. I think of sockets because step 4 should be done
automatically when the file arrives at the workstation. Otherwise I have to
check a directory on the workstation for incomming files every 20 seconds.

Sorry, for asking a question that is not pure python. But I'm still learning
and to know that python is not good for that, helps me also out :-)

regards,
Jürgen




-
This mail sent through IMP: http://horde.org/imp/
___
Python-win32 mailing list
[EMAIL PROTECTED]
http://mail.python.org/mailman/listinfo/python-win32


Re: [python-win32] remote copy with compress/decompress

2004-12-15 Thread python
Hello Jens, hello all,

thanks for your replay. I tried your solution first and get some errors.
Independing of the size in socket.recv and f.read  I allways get an empty
datastring after 1770 bytes. But I found a similiar solution here
http://mail.python.org/pipermail/python-list/2002-July/111754.html. This code
uses struct instead of pickle and that works for me. I don't know if one of this
solutions has some advantages/disadvantages, but I will try it laiter again with
pickle.

But I have some more questions:
1) If the serverside runs in  inifitiv loop, the 'break into running code'
funktion of pythonwin doesn't works, because it is a system call. Is there a way
to stop the programm using a shortcut ?

2) Maybe I want to install the serverside as a service like it is described in
Mark's book. Then step 1) can be solved by stopping the service. Is it save to
run it this way:

>s = socket(AF_INET,SOCK_STREAM)
>s.bind(('',PORT))
>s.listen(1)
>while True:
>   q,v = s.accept()
>   ... rest of code, s and q are not closed

or have I to use threads or what ever else to make sure that the socket is still
listening ? When I tried this code, I get sometimes 'conection refused' errors
after the serverside runs for longer time.

regards,
Jürgen

-
This mail sent through IMP: http://horde.org/imp/
___
Python-win32 mailing list
[EMAIL PROTECTED]
http://mail.python.org/mailman/listinfo/python-win32


[python-win32] Re: remote copy wiht compress/decompress

2004-12-20 Thread python
Hello Jens,

again thanks for your help and code examples. I think I can develop a full
windows conform application with your code, Mark's book and the pipeTestService
example - hope so :-).

But there is one point: pythonservice.exe

has to be registered once per computer and the register process fails if python
is not installed on that machine. I have to install this service on a users
computer without python. Normally I run Gordon McMillans Installer and ship the
exe-file to the users computer. Is there a way to register the pythonservice
without installing python, or run the service without register pythonservice ?

regards,
Jürgen

-
This mail sent through IMP: http://horde.org/imp/
___
Python-win32 mailing list
[EMAIL PROTECTED]
http://mail.python.org/mailman/listinfo/python-win32


[python-win32] Geting values from a thread

2005-01-10 Thread python
Hi all,

I am wondering about the following situation:

I defined a class and inside this class I start a new thread with
thread.start_new_thread. When I set some attributes of that class inside
the thread_function, the attributes are not changed.


class test:
   def __init__(self):
   self.param=''
   thread.start_new_thread(self.run_thread,())
   def run_thread(self):
   self.param='hello'
   return

t=test()
print t.param #result is an empty string

The run_thread function operates on the same object but all changes are lost
when the thread returns. How can I pass values from the thread function to the
main thread ?

regards,
Jürgen



-
This mail sent through IMP: http://horde.org/imp/
___
Python-win32 mailing list
Python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32


AW: [python-win32] Geting values from a thread

2005-01-11 Thread python
Hi,

> That's the whole advantage of threads: they run independently.

Yes, of course thats the reason. But I struggled into that problem, when I tried
to send LogInfoMsg to the eventlog. (W2K,p2.3.3.pywin202)

def SvcDoRun(self):

import servicemanager
servicemanager.LogMsg(
servicemanager.EVENTLOG_INFORMATION_TYPE,
servicemanager.PYS_SERVICE_STARTED,
(self._svc_name_, ''))

while True:
retval=win32event.WaitForMultipleObjects   
(self.close_evt,self.accept_evt),False,win32event.INFINITE)
if retval == win32event.WAIT_OBJECT_0:
win32file.CloseHandle(self.accept_evt)
self.socket.close()
servicemanager.LogMsg(
servicemanager.EVENTLOG_INFORMATION_TYPE,
servicemanager.PYS_SERVICE_STOPPED,
(self._svc_name_, ''))
return

elif retval == win32event.WAIT_OBJECT_0 + 1:

thread.start_new_thread(self.FetchData,(self.socket,))


def FetchData(self,socket):
##code
  import servicemanager
  message= 'Processed %d bytes for client connection and printed out on port
%s' % (value1,value2) ##value 1,2 set inside the FetchData code
  servicemanager.LogInfoMsg(message)


If the service runs in debug mode, the message is written to the console. If the
service runs normal (with 'start' parameter) no message send to the eventlog (no
error message, no exit code, nothing happens). If I put the message line and the
LogInfoMsg line under thread.start_new_thread the message is send to the
eventlog, but I cannot pass the two values of the FetchData function.
That's the whole problem. Don't know how to solve :-(

regards,
Jürgen




-
This mail sent through IMP: http://horde.org/imp/
___
Python-win32 mailing list
Python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32


[python-win32] (no subject)

2005-01-11 Thread python
Hello,

after more than a day I found a solution by myself :-))
The Solution: In the old code the LogInfoMsg is the last statement before the
return statement (in the FetchData function). If I put an other statement
between LogInfoMsg and return statement it works in debug and in start modus -
don't know if this only appears on my machines ?(tested with w2k pywin202/nt04
sp6 pywin203, both p2.3.3). Is that a feature or a bug?

regards,
Jürgen


>> That's the whole advantage of threads: they run independently.
>Yes, of course thats the reason. But I struggled into that problem, when I
>tried to send LogInfoMsg to the eventlog.
>
>def SvcDoRun(self):
>
>import servicemanager
>servicemanager.LogMsg(
>servicemanager.EVENTLOG_INFORMATION_TYPE,
>servicemanager.PYS_SERVICE_STARTED,
>(self._svc_name_, ''))
>
>while True:
>   
retval=win32event.WaitForMultipleObjects((self.close_evt,self.accept_evt),
False,win32event.INFINITE)
>if retval == win32event.WAIT_OBJECT_0:
>win32file.CloseHandle(self.accept_evt)
>self.socket.close()
>servicemanager.LogMsg(
>servicemanager.EVENTLOG_INFORMATION_TYPE,
>servicemanager.PYS_SERVICE_STOPPED,
>(self._svc_name_, ''))
>return
>
>elif retval == win32event.WAIT_OBJECT_0 + 1:
>
>thread.start_new_thread(self.FetchData,(self.socket,))
>
>
>def FetchData(self,socket):
>   ##code
>  import servicemanager
>   message= 'Processed %d bytes for client connection and printed out on 
> >port
%s' \
>% (value1,value2) ##set inside the FetchData code
>  servicemanager.LogInfoMsg(message)
>
>
>If the service runs in debug mode, the message is written to the console. If
>the service runs normal (with 'start' parameter) no message send to the
>eventlog (no error message, no exit code, nothing happens). If I put the
>message line and the LogInfoMsg line under thread.start_new_thread the message
>is send to the eventlog, but I cannot pass the two values of the FetchData
>function.
>That's the whole problem. Don't know how to solve :-(

>regards,
>Jürgen



-----
This mail sent through IMP: http://horde.org/imp/
___
Python-win32 mailing list
Python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32


[python-win32] Re: remote copy wiht compress/decompress

2005-01-19 Thread python

Hi,

thank you all for your hints and helps. I have now a working solution.

But there is still a little problem and as I investigate in services and threads
I like to see it running.

If the socket-connection operates in the local network everything works fine.
But if it operates over a VPN-connetion it post the following error message:


size = q.recv(HDR_SZ)
socket.error: (10035, 'The socket operation could not complete without blocking'

If I use the first version of the programm without running as service it works
over VPN too. So it seems to be a time problem.

The socket doc declares that sockets start with 'blocking' as the default mode.
I tried to use setblocking and settimeout in various ways but that doesn't
change anything. What can I do examine the problem further ?

regards,
Jürgen

-
This mail sent through IMP: http://horde.org/imp/
_______
Python-win32 mailing list
Python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32


Re: [python-win32] getting global addressbook with extended mapi

2005-06-08 Thread python
Hi all,

Mark wrote:
>Why?  Is something missing, or it just tricky?
>
>Sadly, if you want easy, you use CDO/Simple MAPI.  Extended MAPI is not for
>the faint hearted (or for people with deadlines :)

I think, that's not a matter of to be clench or not. Diving into a crazy
organized library with poor and peripheral dokumentation is just waste of time.

But anyway, if there are more faint hearted outside, here is the code working
for me:


from win32com.mapi.mapitags import *
from win32com.mapi import mapi
from win32com.mapi import mapiutil

profileName = "Test"
session = mapi.MAPIInitialize(None)
session =mapi.MAPILogonEx(0,profileName,None, mapi.MAPI_EXTENDED |
mapi.MAPI_LOGON_UI |\
 mapi.MAPI_NO_MAIL |mapi.MAPI_USE_DEFAULT)
hr=session.OpenAddressBook(0,None,mapi.AB_NO_DIALOG)

##open rootcontainer
root=hr.OpenEntry(None,None,mapi.MAPI_BEST_ACCESS)

##get items
root_htab=root.GetHierarchyTable(0)

##restrict for GAL
##SPropValue should be 'DT_GLOBAL' but not defined in mapitags
DT_GLOBAL=131072
restriction = (mapi.RES_PROPERTY,
   (1,
PR_DISPLAY_TYPE,
(PR_DISPLAY_TYPE, DT_GLOBAL)))

## get GAL's entryid tuple
gal_id = mapi.HrQueryAllRows(root_htab,
   (PR_ENTRYID),
   restriction,
   None,
   0)

## extract GAL's entryid
gal_id = gal_id[0][0][1]

## open GAL
gal=hr.OpenEntry(gal_id,None,mapi.MAPI_BEST_ACCESS)

## get content
gal_list=gal.GetContentsTable(0)

## no readable tagname for smpt
PR_SMTP=972947486

rows = mapi.HrQueryAllRows(gal_list,
   (PR_ENTRYID,
PR_DISPLAY_NAME_A,PR_ACCOUNT,PR_SMTP),
   None,
   None,
   0)
for eid,name,alias,smtp in rows:
print name[1],alias[1],smtp[1]

mapi.MAPIUninitialize()


PS.: Expanding a distribution lists of the GAL  needs to set the address type of
that dl to 'MAPIPDL', but I'm lacking the permissions - crazy, crazy

regards,
Jürgen

-
This mail sent through IMP: http://horde.org/imp/
___
Python-win32 mailing list
Python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32


[python-win32] win32gui.SetCapture

2005-09-16 Thread python
Hi,

the following code

pyhdl=win32gui.FindWindow(None,'PythonWin')
win32gui.SetForegroundWindow(pyhdl)
win32gui.SetCapture(pyhdl)

results in:

Traceback (most recent call last):
  File "C:\Python24\Lib\site-packages\pythonwin\pywin\framework\scriptutils.py",
line 310, in RunScript
exec codeObject in __main__.__dict__
  File "C:\test\screen\screen_capture.py", line 51, in ?
win32gui.SetCapture(pyhdl)
error: (0, 'SetCapture', 'No error message is available')

Any hints ?

regards,
Jürgen

-
Versandt durch den Webmaildienst der LDC GmbH Bonn
___
Python-win32 mailing list
Python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32


Re: [python-win32] Overlay Icon Question and network drives

2008-04-16 Thread python

Hi Andrea,

the code in my first link was from the mercurial extension TortoiseHG. They
found some issues that the icon overlay slows down network devices. See here:

https://sourceforge.net/tracker/index.php?func=detail&aid=1892791&group_id=199155&atid=968354

Could you please tell if you have the same issues with the code Roger posted ?

Thanks,
Jürgen

-
Versandt durch den Webmaildienst der LDC GmbH Bonn
___
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32


Re: [python-win32] Hide the console as soon as the script starts.

2008-05-13 Thread python
Antony,

If you're just trying to hide the console Window, rename your python
script with a *.pyw file extension or launch it via pythonw.exe vs.
python.exe.

I have no idea how to have a Python application display an icon in the
System Tray (vs. Taskbar). That's a very interesting question.

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


[python-win32] Is WMI ever disabled?

2008-05-16 Thread python
I've been enjoying a lot of the WMI examples posted on this mailing
list.

Does anyone know if WMI is ever fully or partially disabled by corporate
customers, eg. as a way to secure workstations?

I'm trying to figure out how confident one can be about assuming WMI
functionality will be available on real-world 'locked-down' corporate
workstations.

Thank you,
Malcolm
___
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32


Re: [python-win32] Request for comments

2008-05-22 Thread python
Tim,

1. Layout (color, font, margins) looks great.

2. Home page:

a. Include a next (page) link in header/footer?

b. Include an about page with brief note about site's reStructuredText
markup and Sphinx. Include a brief description of the Show Source links
(cool!).

3. Getting Started page:

a. Include links to pywin32 and comtypes downloads.

4. When I randomly walked the site, the previous/next links in the
headers and footers don't seem to link to what I would consider the
previous/next logical pages.

Looking forward to reading your site.

Regards,
Malcolm
_______
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32


Re: [python-win32] Request for comments

2008-05-22 Thread python
Tim,

Some ideas for high-level sections:

- Creating COM components
- Interfacing to COM components
- Creating NT services
- Sending/receiving Windows messages
- Interfacing to the clipboard
- Interfacing to DDE
- Monitoring processes (Task Manager stats on a process)
- Reading/writing NT Event logs

The News2News site may give you (and your audience) some ideas as well.
>From this site's about page:

QUOTE: Welcome to the FoxPro WinAPI Online Reference, your source of
information on how to use Windows API functions in Visual FoxPro.
Several hundred proven FoxPro code samples make the core of this
reference. Use "copy and paste" and try them now. Sometimes a line of
code is worth a dozen of pages and hours of online searching.

http://news2news.com/vfp/index.php

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


[python-win32] Capturing a Python script's Task Manager statistics

2008-06-20 Thread python
Anyone know of a way to have a Python script capture its own Task
Manager statistics?

I have a long running Python script whose CPU, memory, disk i/o, and
network traffic I would like to monitor.

An alternative more generic approach would be to run an 'observer'
script that would monitor all Task Manager statistics so I could watch
multiple scripts.

Motivation: I would like to track this script's resource requirements
and if the script detects its exceeding some pre-defined resource limits
for a certain amount of time, to send out an alert.

Any suggestions (or recommendation on a 3rd party that does the same)
appreciated.

Thank you,
Malcolm
___
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32


[python-win32] win32com in a 64bit laptop

2011-10-28 Thread love python

I just got a 64bit laptop and install python 2.7.2 (Windows AMD64 / Intel 64
/ X86-64 binary) and other packages. When i run the previous file, I find to
import win32com.client bc the program needs to read a word document as
follows:

app = win32com.client.gencache.EnsureDispatch('Word.Application')
self.doc = app.Documents.Open(...)

Can someone tell me how I should do here? Thanks.
Bill
-- 
View this message in context: 
http://old.nabble.com/win32com-in-a-64bit-laptop-tp32741987p32741987.html
Sent from the Python - python-win32 mailing list archive at Nabble.com.

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


Re: [python-win32] win32com in a 64bit laptop

2011-10-30 Thread love python

Thanks for the reply. I removed the Softwares and reinstall them with 32bit
again. But I have
the following questions:
1. When installing xlutils1.4.1.win32, I got the following errors:
couldn't create key for
i) xlutils-py2.7; ii) python 2.7 xltuils-1.4.1
Then I got the error "Couldn't set key value" for "...\Removexlutils.exe" -u
"...\xltuils-wininst.log"

2. Next, when installing win32com, i got the following error msg twice:
The program can't start because python23.dll is missing from your
computer...

When I run my previous program, I got a runtime error as follows:

Traceback (most recent call last):
  File "J:\MyProjects\Python\MySVD\src\SVDDecomposition.py", line 19, in

from xlutils.copy import copy 
  File
"F:\Softwares\Working\Languages\Python27\lib\site-packages\xlutils\copy.py",
line 7, in 
from xlutils.filter import process,XLRDReader,XLWTWriter
  File
"F:\Softwares\Working\Languages\Python27\lib\site-packages\xlutils\filter.py",
line 9, in 
import xlrd,xlwt
ImportError: No module named xlwt

How can I fix it? Thanks.
Bill



Mark Hammond-4 wrote:
> 
> If your version of Word is 32bit (which it probably is), you should just 
> stick with the 32bit version of Python - it works fine on a 64bit machine.
> 
> HTH,
> 
> Mark
> 
> 

-- 
View this message in context: 
http://old.nabble.com/win32com-in-a-64bit-laptop-tp32741987p32745032.html
Sent from the Python - python-win32 mailing list archive at Nabble.com.

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


Re: [python-win32] win32com in a 64bit laptop

2011-10-30 Thread love python

I got python from:

www.python.org/download

and choose 

•Python 2.7.2 Windows Installer (Windows binary -- does not include source)

It should be a good version too, right? What I did is to remove all the
64bit
versions and reinstall these software systems for win32. Thanks in advance.
Bill



Michel Claveau wrote:
> 
> Hi!
> 
>> Python27
>> The program can't start because python23.dll...
> 
> Perhaps a bad version of pywin32...
> 
> @-salutations
> -- 
> Michel Claveau 
> 
> _______
> python-win32 mailing list
> python-win32@python.org
> http://mail.python.org/mailman/listinfo/python-win32
> 
> 

-- 
View this message in context: 
http://old.nabble.com/win32com-in-a-64bit-laptop-tp32741987p32747181.html
Sent from the Python - python-win32 mailing list archive at Nabble.com.

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


[python-win32] Response.Flush not working

2008-03-07 Thread python-win32
Hi All,

I searched for this but couldn't find it anywhere: I've just started  
running Python in Classic ASP, and would like to Response.Flush  
periodically on a page with a lot of processing behind it.

However, it seems to have no effect. I confirmed that Response.Buffer = True.

Any suggestions?

Regards,
Ryan McGreal

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


[python-win32] DDE Server Poke

2010-09-08 Thread jon vs. python
Hi,
I'm new to pywin32 and DDE. I'm trying to create a DDE server that
interfaces an Excel Worksheet. Excel will act as a client in order to read
from and write to the server. I had no problem implementing the Request
operation (*). But I failed to implement Poke operation in the server.

Any hint or sample code on how to implement DDE Poke ?

Thanks, Jon.

(*) Based on
http://www.google.com/codesearch/p?hl=es#OAMlx_jo-ck/tools/third_party/python_26/Lib/site-packages/win32/Demos/dde/ddeserver.py&q=dde%20lang:python&sa=N&cd=1&ct=rc
_______
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32


[python-win32] pywintypes.com_error- no data source was provided when sending outlook attachment

2016-03-20 Thread Joe via python-win32
Hello,Iam trying to send an email through outlook 2010 on a win 7 64 bit oswith 
python 2.7 32 bit and win32com 32 bit. I am using the same codeexample found in 
many Google search results. This chunk of code willrun fine if I rem out the 
attachment, but once I try adding theattachment, I get an error about 'no data 
source provided'. Thissame sample of code appears to work fine in many 
instances, but I'vealso seen this error appear on the net since 2002. I've also 
changedthe attachment line use this format, and have tried it myself, butno 
luck#newMail.Attachments.Add('Location', olByValue, 1, 'Description')

I've named changed the name of the attachment every way possible (r'c:\test.txt 
  c:\test.txt c:\\test.txt) and I've placed it in other directories, but still 
the same error.  
Any suggestions

importwin32com.clientolMailItem = 0x0
obj = win32com.client.Dispatch("Outlook.Application")
newMail = obj.CreateItem(olMailItem)
newMail.Subject = "I AM SUBJECT!!"
newMail.Body = "I AM IN THE BODY\nSO AM I!!!"
newMail.To = "them...@mail.org"
#newMail.CC = "moreaddresses here"
#newMail.BCC = "aaa"
attachment1 = r'c:\test.txt'
newMail.Attachments.Add(attachment1)
newMail.Send()
 pywintypes.com_error: (-2147352567, 'Exception occurred.', (4096, 'Microsoft 
 Outlook', 'Cannot add the attachment; no data source was provided.', 
 None, 0, -2147352567), None)___
python-win32 mailing list
python-win32@python.org
https://mail.python.org/mailman/listinfo/python-win32


[python-win32] wincom32.client problem?

2018-10-02 Thread mastro59 via python-win32
I ahve been trying to communicate with an Instrument GUI using python and a
COM Object. This is quite simple using wincom32, but somethind with this
client required additional extension not needed in other lunguages. I wander
id someone here has experience and can explain how to solve this.in VBS,
PAscal and C# the commands are quite simple, after creting the object in
VBS: set app = CreateObject("LeCroy.XStreamDSO")in Python is similar:import
win32com.clientapp=win32com.client.Dispatch("LeCroy.XStreamDSO") done this
the object I can use is "app"the commands are in
VBS:app.Acquisition.Horizontal.MaxSamplesOrRateDownapp.Acquisition.Horizontal.MaxSamplesOrRateUpapp.Acquisition.TriggerMode
= "single"app.Measure.ClearSweepsin Python I have to add .ActNow() to make
them work to some of these commands, and I do not understand why, I will
have to
use:app.Acquisition.Horizontal.MaxSamplesOrRateDown.ActNow()app.Acquisition.Horizontal.MaxSamplesOrRateUp.ActNow()app.Acquisition.TriggerMode
= "single"app.Measure.ClearSweeps.ActNow()In C#(Visualstudio 2017)  and
Pascal (Lazarus) I do not have this problem, only in Python.can someone
help?thanks



--
Sent from: http://python.6.x6.nabble.com/Python-python-win32-f1948913.html___
python-win32 mailing list
python-win32@python.org
https://mail.python.org/mailman/listinfo/python-win32


[python-win32] Opening existing memory mapped files with pywin32

2021-02-16 Thread rhyslloyd1 via python-win32
Hello. Sorry if this is the wrong place to ask my question.

I am trying to open a memory mapped file using Python. I originally used the 
"mmap" module from Python however I had issues with it because I had to use a 
fixed size for the file even though my goal was to open an existing file of 
which the size would be unknown. I am now using the "mmapfile.mmapfile" 
function. My code looks like [this](https://pastebin.com/QygT2wp6). In the 
[docs](http://timgolden.me.uk/pywin32-docs/mmapfile__mmapfile_meth.html) it 
says I can use a file name of "None" if I'm planning on opening an existing 
file. [This](https://pastebin.com/2FVhpDiB) is the error I get when running my 
code.

I'm a novice Python user and I don't know much at all about the Windows API. 
Thanks in advance for any help!_______
python-win32 mailing list
python-win32@python.org
https://mail.python.org/mailman/listinfo/python-win32


Re: [python-win32] Clipboard Documentation

2021-11-30 Thread gw1500 via python-win32

Hi Tim,

Thanks for the reply. I read about that but was hoping to use pywin32. I 
can see now the folly of that decision.


I have a working minimal test but am looking for something a bit more 
automated. I bring my app window to the top using pywin32 and a line I 
need is already highlighted. I can ctrl-c from the keyboard and 
pyperclip works just fine. However, since the line is already 
highlighted is there a way to get it without user interaction (ctrl-c)?


On 11/29/2021 6:52 PM, Tim Roberts wrote:

Dennis Putnam wrote:


I'm using pywin32 and it is my understanding it can also be used for 
copying text from an app to the clipboard. I have been able to find 
scant documentation for that. Can someone send me a link to some 
definitive documentation? TIA.


The easy way is to use the well-respected `pyperclip` module. You can 
install it with pip.  The Win32 clipboard APIs are a pain to work 
with, and of course don't work at all on other systems.



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


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


Re: [python-win32] Clipboard Documentation

2021-12-01 Thread gw1500 via python-win32

On 12/1/2021 3:07 AM, Tim Roberts wrote:

On 11/30/21 7:04 AM, gw1500 via python-win32 wrote:



Thanks for the reply. I read about that but was hoping to use 
pywin32. I can see now the folly of that decision.


I have a working minimal test but am looking for something a bit more 
automated. I bring my app window to the top using pywin32 and a line 
I need is already highlighted. I can ctrl-c from the keyboard and 
pyperclip works just fine. However, since the line is already 
highlighted is there a way to get it without user interaction (ctrl-c)?


 I don't know how much trouble you want to go to.  If you can get the 
window handle of the text box that has your text, you can send a 
WM_COPY message to it.  With the standard controls, that tells it to 
do a "copy" operation with the currently selected text.



Hi Tim,

Thanks. That was what I wanted to know.
___
python-win32 mailing list
python-win32@python.org
https://mail.python.org/mailman/listinfo/python-win32


Re: [python-win32] Clipboard Documentation

2021-12-01 Thread gw1500 via python-win32

Hi Dietmar,

Thanks. I lot to it but I'll give it a try.

On 12/1/2021 11:33 AM, Dietmar Schwertberger wrote:
I've been using the code below for 20 years now for text copy & paste. 
No guarantees, though.



Regards,

Dietmar


def copy_to_clipboard(text, window_handle=0):
    """copy_to_clipboard(window_handle, text):
    copy a string to the clipboard."""
    win32clipboard.OpenClipboard(window_handle)
    try:
    win32clipboard.EmptyClipboard()
    if sys.version_info.major==2:
    is_unicode = isinstance(text, str)
    else:
    is_unicode = True
    if is_unicode:
win32clipboard.SetClipboardData(win32clipboard.CF_UNICODETEXT, text)
    else:
    win32clipboard.SetClipboardText(text)
    finally:
    win32clipboard.CloseClipboard()

_formats = {}
def _format_to_number(format):
    if not format in _formats:
    number = win32clipboard.RegisterClipboardFormat(format)
    _formats[format] = number
    return _formats[format]

#def copy_from_clipboard(format=win32clipboard.CF_TEXT, window_handle=0):
def copy_from_clipboard(format=win32clipboard.CF_UNICODETEXT, 
window_handle=0):

    win32clipboard.OpenClipboard(window_handle)
    if isinstance(format, str):
    format = _format_to_number(format)
    try:
    ret = win32clipboard.GetClipboardData(format)
    except TypeError:
    return None
    finally:
    win32clipboard.CloseClipboard()
    return ret



#def check_clipboard_format(format=win32clipboard.CF_TEXT, 
window_handle=0):
def check_clipboard_format(format=win32clipboard.CF_UNICODETEXT, 
window_handle=0):

    if isinstance(format, str):
    format = _format_to_number(format)
    win32clipboard.OpenClipboard(window_handle)
    try:
    return win32clipboard.IsClipboardFormatAvailable(format)
    finally:
    win32clipboard.CloseClipboard()


def get_clipboard_formats(window_handle=0):
    format = 0
    formats = []
    win32clipboard.OpenClipboard(window_handle)
    standard_formats = {}
    for n in dir(win32clipboard):
    if not n.startswith("CF_"): continue
    standard_formats[getattr(win32clipboard, n)] = n[3:]
    try:
    while True:
    format = win32clipboard.EnumClipboardFormats(format)
    if not format:
    break
    if format in standard_formats:
    formats.append(standard_formats[format])
    else:
    formats.append( 
win32clipboard.GetClipboardFormatName(format) )

    finally:
    win32clipboard.CloseClipboard()
    return formats


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


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


Re: [python-win32] python-win32 Digest, Vol 232, Issue 1

2022-10-11 Thread monetclause--- via python-win32
I've had my challenges with 3.10 and stayed on 3.9, with good results.

Sent from Android 
 
  On Tue, Oct 11, 2022 at 11:00, 
python-win32-requ...@python.org wrote:   Send 
python-win32 mailing list submissions to
    python-win32@python.org

To subscribe or unsubscribe via the World Wide Web, visit
    https://mail.python.org/mailman/listinfo/python-win32
or, via email, send a message with subject or body 'help' to
    python-win32-requ...@python.org

You can reach the person managing the list at
    python-win32-ow...@python.org

When replying, please edit your Subject line so it is more specific
than "Re: Contents of python-win32 digest..."


Today's Topics:

  1. Unpredictable behavior of pywin32 on new computer (Zach York)
  2. Re: Unpredictable behavior of pywin32 on new computer
      (Tim Roberts)


--

Message: 1
Date: Mon, 10 Oct 2022 12:34:43 -0700
From: Zach York 
To: python-win32@python.org
Subject: [python-win32] Unpredictable behavior of pywin32 on new
    computer
Message-ID:
    
Content-Type: text/plain; charset="utf-8"

Hello,

I have recently upgraded my computer and after upgrading and installing
pywin32, I have found the behavior to be extremely unpredictable and in a
lot of cases, just wrong.

Environment:
Python 3.10 (upgraded from python 3.9 on the previous computer)
pywin32 304
Windows 10: 19044.2006

My scripts are mostly trying to do some background clicking using
PostMessage/SendMessage  and window resizing/positioning using MoveWindow.
I used to be able to use SendMessage reliably before this computer upgrade,
but now it seems like I need a combination of PostMessage + SendMessage to
see a click at all). For MoveWindow, the results are entirely unpredictable
(window isn't moved at all, window resized and moved to the wrong location,
etc).

I assume this has to somehow be with my setup and not pywin32, but I am
lost on what might be causing this weird behavior. Any insight would be
greatly appreciated!

Thanks,
Zach
-- next part --
An HTML attachment was scrubbed...
URL: 
<https://mail.python.org/pipermail/python-win32/attachments/20221010/b5e420d7/attachment-0001.html>

--

Message: 2
Date: Mon, 10 Oct 2022 16:41:50 -0700
From: Tim Roberts 
To: python-win32@python.org
Subject: Re: [python-win32] Unpredictable behavior of pywin32 on new
    computer
Message-ID: 
Content-Type: text/plain; charset="utf-8"; Format="flowed"

Zach York wrote:
>
> I have recently upgraded my computer and after upgrading and 
> installing pywin32, I have found the behavior to be extremely 
> unpredictable and in a lot of cases, just wrong.
> ...
> My scripts are mostly trying to do some background clicking using 
> PostMessage/SendMessage ?and window resizing/positioning using 
> MoveWindow. I used to be able to use SendMessage reliably before this 
> computer upgrade, but now it seems like I need a combination of 
> PostMessage?+ SendMessage to see a click at all). For MoveWindow, the 
> results are entirely unpredictable (window isn't moved at all, window 
> resized and moved to the wrong location, etc).
>
> I assume this has to somehow be with my setup and not pywin32, but I 
> am lost on what might be causing this weird behavior. Any insight 
> would be greatly appreciated!

If you upgraded your display as well, the problem is probably the 
display scaling.? Unless you mark your application has being "high DPI 
aware", Windows will lie to you about pixel locations.? If your display 
is 3840x2160, but you have scaling set to 200%, your "non-aware" 
application will be told that the display is 1920x1080, and the pixel 
coordinates you are sending to other applications will be wrong.? Go 
read about "high DPI aware" applications.? It's a mess.

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

-- next part --
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 3428 bytes
Desc: S/MIME Cryptographic Signature
URL: 
<https://mail.python.org/pipermail/python-win32/attachments/20221010/a6f92006/attachment-0001.bin>

--

Subject: Digest Footer

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


--

End of python-win32 Digest, Vol 232, Issue 1
****
  
___
python-win32 mailing list
python-win32@python.org
https://mail.python.org/mailman/listinfo/python-win32


[python-win32] Pywin32 Windows Service not responding

2023-03-25 Thread jeremy.farmer1206 via python-win32
Hi, I am looking for some assistance with utilizing pywin32 in order to create 
a Windows Service.

I've tried to create as bare-bones of an application as I could inheriting from 
win32serviceutil.ServiceFramework

import traceback
import win32serviceutil
import win32service
import win32event
import servicemanager
import socket
import time
import os
import sys

class MyService(win32serviceutil.ServiceFramework):
_svc_name_ = 'MyPythonService'
_svc_display_name_ = 'My Python Service'
_svc_description_ = 'This is a sample Python Wind

def __init__(self, args):
win32serviceutil.ServiceFramework.__init__(se
self.hWaitStop = win32event.CreateEvent(None,
socket.setdefaulttimeout(60)
self.is_alive = True
def SvcStop(self):
self.ReportServiceStatus(win32service.SERVICE
win32event.SetEvent(self.hWaitStop)
self.is_alive = False

def SvcDoRun(self):
self.ReportServiceStatus(win32service.SERVICE
self.ReportServiceStatus(win32service.SERVICE
# win32event.WaitForSingleObject(self.hWaitSt
try:
servicemanager.LogMsg(servicemanager.EVEN
PYS_SERVICE_STARTED, (self._svc_name_, ''))
self.main()
except Exception as ex:
servicemanager.LogErrorMsg("Exception in
eback.format_exc()))
raise

def main(self):
while self.is_alive:
with open('test.txt', 'a') as f:
f.write('Service loop...')
time.sleep(2)

if __name__ == '__main__':
if len(sys.argv) == 1:
servicemanager.Initialize()
servicemanager.PrepareToHostSingle(MyService)
servicemanager.StartServiceCtrlDispatcher()
else:  win32serviceutil.HandleCommandLine(MyService)

I've installed it via opening an admin command prompt and running

python main.py install

It installs successfully but if I attempt to run it, I get

[image.png]

Or

>>python main.py start
> Starting service MyPythonService
> Error starting service: The service did not respond to the start or control 
> request in a timely fashion.

debugging seems to work, or at least does not give any errors

> python main.py debug
> Debugging service MyPythonService - press Ctrl+C to stop.Info 0x40001002 - 
> The MyPythonService service has started.

I believe my pywin32 is fully up to date

> python -m pip install --upgrade pywin32
> Requirement already satisfied: pywin32 in 
> c:\users\jerem\appdata\local\programs\python\python311\lib\site-packages (305)

Misc

> python --version
> Python 3.11.2

[image.png]

Any assistance is very much appreciated!

Sent with [Proton Mail](https://proton.me/) secure email._______
python-win32 mailing list
python-win32@python.org
https://mail.python.org/mailman/listinfo/python-win32


[python-win32] AddObject from C

2023-09-19 Thread dzzie via python-win32
Hi guys
I am working with an embedded interpreter, how can I share an existing COM 
object from the C api ?(without using the ROT)

Background:
The host process is VB6 with a C helper DLL.
I have stripped down the pywin32 library to compile directly into my helper dll 
with just the COM access features.
Right now I can createobject() and getobject() in python using the new 
namespaces.

Experimenting with using this for app automation similar to the microsoft 
script control and its addobject functionality.
Bringing the COM code into my helper dll to see if I can get around not being 
able to call PyFinalize with the full library.




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


Re: [python-win32] AddObject from C

2023-09-19 Thread dzzie via python-win32
Seems to be solved:

/lib/site-packages/pycom/__init__.py
def GetObject(Pathname=None, Class=None, clsctx=None):

...if Class is not None:
    return GetActiveObject(Class, clsctx)
    else:
    #first check to see if its an in process COM object shared from VB 
before we check ROT
    v = pycomint.HostResolver(Pathname); 
    #print(type(v)) # or 
    if v is not None:
    return __WrapDispatch(v, Pathname, clsctx=clsctx)
    else:
    return Moniker(Pathname, clsctx)

PythonCOM.cpp
static PyObject *pythoncom_HostResolver(PyObject *self, PyObject *args)
{
    int rv = 0;
    char* s;

    if(vbHostResolver == NULL) return Py_BuildValue("");
    if (!PyArg_ParseTuple(args, "s", &s)) return Py_BuildValue("");

    //PY_INTERFACE_PRECALL;
    rv = vbHostResolver(s, 0, 0, 0);
    //PY_INTERFACE_POSTCALL;
    
    if (rv == 0)  return Py_BuildValue("");

    return PyCom_PyObjectFromIUnknown((IUnknown*)rv, IID_IDispatch, FALSE);
}

---
VB6 implementation
Public Function HostResolver(ByVal buf As Long, ByVal v1 As Long, ByVal v2 As 
Long, ByVal v3 As Long) As Long
    
    On Error Resume Next
    
    Dim key As String
    Dim o As Object

    key = LCase(StringFromPointer(buf))
    Set o = SharedObjects(key)
    
    If Not o Is Nothing Then
    HostResolver = ObjPtr(o)
    Else
    HostResolver = 0
    End If
  
End Function


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


[python-win32] VB6 Listbox methods fail through ROT

2023-10-04 Thread dzzie via python-win32
 Wondering if anyone might have an insight on this.
If we add a vb6 listbox to the ROT, and try to access it using GetObjectwe can 
not access any of its methods with an error "Member not found"
 import win32com.client

form1 = win32com.client.GetObject('PyComTest.Form1')
form1.caption = "hi from vb!!"  # works
#form1.Move(0) #pywintypes.com_error: (-2147352573, 'Member not found.', None, 
None)

List1 = win32com.client.GetObject('PyComTest.List1')
#List1.AddItem('') #pywintypes.com_error: (-2147352573, 
'Member not found.', None, None)
List1.Clear() #pywintypes.com_error: (-2147352573, 'Member not found.', None, 
None)
--
as a sanity check both do work from vb script
Set form1 = GetObject("PyComTest.Form1")
form1.caption = "test"
form1.Move(0)

Set List1 = GetObject("PyComTest.List1")
List1.AddItem "***** VBS SAYS HELLO ***"
Currently using a vb6 standard exe manually adding objects to the ROT, and 
python 311 exe to run the scripts externally. 
I have not yet tried with a vb6 activex exe. 
Most things do work like textboxes, form methods etc. 
  _______
python-win32 mailing list
python-win32@python.org
https://mail.python.org/mailman/listinfo/python-win32


[python-win32] __getattr__ Error

2024-03-17 Thread Jannis via python-win32

Hello together,


I am trying to automate a point cloud creation out of CATParts in CATIA.
The win32com client can access CATIA documents, but NOT methods and
attributes in the parts. I get the following error:


File
"C:\Users\th80im\source\repos\PythonPointCloudCreation\PythonPointCloudCreation\PythonPointCloudCreation\py37_env_1\lib\site-packages\win32com\client\dynamic.py",
line 638, in __getattr__
    raise AttributeError("%s.%s" % (self._username_, attr))
AttributeError: .HybridShapes


I guess, there is something wrong with the registering of CATIA, or the
installation of the client? Or am I looking in the wrong direction?


Thank you & Best Regards

ioannis

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


Re: [python-win32] How to correctly handle events using win32com ?

2024-11-29 Thread dornech via python-win32

Hi there,

exactly, Mark is right on this.
You can use very COM object method as you use out of VBA for example.

I am working on a wrapper for a more "pythonized" access to the EXCEL
API, you may have alokk on it as soon as it is published.

BG
Chris



Am 29.11.2024 um 20:10 schrieb Mark Hammond:


It's been a while since I've done any of this, but I think there's an
"xlApp.Quit()" method you can use? If so, then you might be able to
break out of the look when "PumpWaitingMessages()" returns 1 - that
will mean the message queue has received a WM_QUIT.


On 2024-11-29 12:17 p.m., Gauthier ABRIAL wrote:

Hello,
I'm looking for some advice on how to correctly handle events using
win32com. If I take the example of a very simple Excel automation, I
tested two things.

 *
Code1 below use pythoncom.PumpMessages() but I don't know how to
stop it when the Excel is closing. I guess I should send a
WM_QUIT message but I don't know how.
 *
Code2 below use a while loop on pythoncom.PumpWaitingMessages()
but once I stop the loop the COM server freeze as it is waiting
for the messages it sends to be processed before closing. I guess
I should pump all the remaining messages but I don't know how.

Maybe I should use a totally different approach.
Thanks a lot for your help.

G.

 Code1 Starts ---
import win32com.client as win32
import pythoncom

#The event handlers
class wbEvents:
    def OnBeforeClose(self, Cancel):
        print('Closing Workbook')
        # Send WM_QUIT here ?

xlApp = win32.Dispatch("Excel.Application") #Open Excel
xlApp.Visible=True #Make Excel Visible
xlwb = xlApp.Workbooks.Add() #Create a workbook
ws=xlwb.Sheets("Sheet1") #Get the first worksheet
xl_events=win32.WithEvents(xlwb,wbEvents) #Add and Event handler
pythoncom.PumpMessages()
 Code1 Ends ---

 Code2 Starts ---
import win32com.client as win32
import pythoncom
import time

#The event handlers
class wbEvents:
    def OnBeforeClose(self, Cancel):
        print('Closing Workbook')
        global keepOpen
        keepOpen = False

xlApp = win32.Dispatch("Excel.Application") #Open Excel
xlApp.Visible=True #Make Excel Visible
xlwb = xlApp.Workbooks.Add() #Create a workbook
ws=xlwb.Sheets("Sheet1") #Get the first worksheet
xl_events=win32.WithEvents(xlwb,wbEvents) #Add and Event handler
# define initalizer
keepOpen = True
while keepOpen:
    time.sleep(0.1)
    pythoncom.PumpWaitingMessages()
-------- Code2 Ends ---


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


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


[python-win32] Trouble with list iteration / comprehension for wrapped COM objects

2025-04-18 Thread dornech via python-win32

Hi there,

I am working on an EXCEL wrapper to "phytonize" access to EXCEL.

I create a wrapper class for all objects classes derived from abasic 
wrapper class which mainly ensures that calls are snaked-case and 
pyhtonized calls work. I. e. workbokkobject.SaveAs, 
workbookobject.saveas and workbokkobject.save_as would all work. This is 
done by overloaded __getattr__ and __setattr__ methods.


The "real" EXCEL object is stored in the attribute "_xlWrapped".

The overloaded __getattr__ also ensures that when retrieving f. e. a 
workbook from the application wrapper, that the resulting EXCEL object 
is wrapped as well. I. e. let xlapp be my wrapped EXCEL then 
xlapp.active_workbook would return a reference to a wrapped Workbook 
object which contains the reference to the "real" EXCEL workbook object 
in the attribute _xlwrapped.


I also overload __getitem__ to allow xlapp[1] as short for 
xlapp.workbooks(1).


Some of these classes I do extend for example to check existence of a 
worksheet in a workbook.


This as very brief introduction.

Now I am struggeling with list comprehension and indexes.

    # access un-wrapped EXCEL
    print(xlapp._xlWrapped.Workbooks(1).Name)
    print(xlapp._xlWrapped.Workbooks(2).Name)
    for i, wb in enumerate(xlapp._xlWrapped.Workbooks):
    print(i, wb.Name)

    # access wrapped EXCEL
    print(xlapp.Workbooks(1).Name)
    print(xlapp.Workbooks(2).Name)
    for i, wb in enumerate(xlapp.Workbooks):
    print(i, wb.Name)

This prints
    WB1.xls
    WB2.xls
    0  WB1.xls
    1  WB2.xls
    WB1.xls
    WB2.xls
 and aborts with an windows/COM error:

 ret = self._oleobj_.InvokeTypes(170, LCID, 2, (13, 0), ((12, 1),),Index
^
pywintypes.com_error: (-2147352567, 'Ausnahmefehler aufgetreten.', (0, 
None, None, None, 0, -2147352565), None)


Obviously when looping via the wrapper object the index is not 
automatically adjusted.
However, I must not increase the index by on in __getitem__ because then 
the index would alway be increased.


It seems, püywin32 has some special support for list comprehension and 
index adjustment for COM objects?

I haven't worked with an iterator before but is this the solution?

Thanks in advance.

Best
Christoph





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


Re: [python-win32] Trouble with list iteration / comprehension for wrapped COM objects

2025-04-19 Thread dornech via python-win32

Hi Mark,

thanks for spending time on my question. Sometimes when you are writing, 
you are already on the way to the solution ... Actually I haven't worked 
with an iterator object before an was unsure how to do it. But sometimes 
you must simply try. With an iterator for the Office Collection object 
wrappers like my wrapper for Applicaiton.Workbooks in addition to the 
overloaded __getitem__ it seems to work.


I plan to publish the package (alongside with a package with a COM 
object template class package for easening writing COM objects) as soon 
as I have done some test scripts ready. Probably it is of interest for 
you and the others here.


Best regards
Christoph


Am 19.04.2025 um 04:31 schrieb Mark Hammond:


I'm not sure what's going wrong here. Does fetching the list of 
workspaces as a simple list work? That would be a workaround, and
feel free open an issue at https://github.com/mhammond/pywin32 since 
it shouldn't break that way.


Cheers

On 2025-04-18 8:33 p.m., dornech via python-win32 wrote:

Hi there,

I am working on an EXCEL wrapper to "phytonize" access to EXCEL.

I create a wrapper class for all objects classes derived from abasic 
wrapper class which mainly ensures that calls are snaked-case and 
pyhtonized calls work. I. e. workbokkobject.SaveAs, 
workbookobject.saveas and workbokkobject.save_as would all work. This 
is done by overloaded __getattr__ and __setattr__ methods.


The "real" EXCEL object is stored in the attribute "_xlWrapped".

The overloaded __getattr__ also ensures that when retrieving f. e. a 
workbook from the application wrapper, that the resulting EXCEL 
object is wrapped as well. I. e. let xlapp be my wrapped EXCEL then 
xlapp.active_workbook would return a reference to a wrapped Workbook 
object which contains the reference to the "real" EXCEL workbook 
object in the attribute _xlwrapped.


I also overload __getitem__ to allow xlapp[1] as short for 
xlapp.workbooks(1).


Some of these classes I do extend for example to check existence of a 
worksheet in a workbook.


This as very brief introduction.

Now I am struggeling with list comprehension and indexes.

    # access un-wrapped EXCEL
    print(xlapp._xlWrapped.Workbooks(1).Name)
    print(xlapp._xlWrapped.Workbooks(2).Name)
    for i, wb in enumerate(xlapp._xlWrapped.Workbooks):
    print(i, wb.Name)

    # access wrapped EXCEL
    print(xlapp.Workbooks(1).Name)
    print(xlapp.Workbooks(2).Name)
    for i, wb in enumerate(xlapp.Workbooks):
    print(i, wb.Name)

This prints
    WB1.xls
    WB2.xls
    0  WB1.xls
    1  WB2.xls
    WB1.xls
    WB2.xls
 and aborts with an windows/COM error:

 ret = self._oleobj_.InvokeTypes(170, LCID, 2, (13, 0), ((12, 1),),Index
^
pywintypes.com_error: (-2147352567, 'Ausnahmefehler aufgetreten.', 
(0, None, None, None, 0, -2147352565), None)


Obviously when looping via the wrapper object the index is not 
automatically adjusted.
However, I must not increase the index by on in __getitem__ because 
then the index would alway be increased.


It seems, püywin32 has some special support for list comprehension 
and index adjustment for COM objects?

I haven't worked with an iterator before but is this the solution?

Thanks in advance.

Best
Christoph





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


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


[python-win32] PYTHON DEVELOPER with 3+ years Exp. ( Job Location : Hyderabad )

2015-09-24 Thread Apple Informatics via python-win32

  


Hi
 We are looking for a PYTHON DEVELOPER  with  3+ years Exp. ·   
  Strong in Python· Django framework· Good at Rest API· 
Decent communication skills· 3+ Years’ experience· Full time – 
Immediate Joinee            Job Location : Hyderabad Please send your profile 
to appleinformat...@yahoo.com  along with below detailsFull Name:Total 
Exp:Relevant Exp:CTC:ECTC:Notice Period:Are you available immediately for the 
position?Current Location:Open to relocate to Hyderabad:  Thanks & Regards
K.Seshagirirao 
Manager-Operations
Apple Informatics
www.appleinformatics.com
040-65144951,9000611370

   

   

   

   

   

   

   

   

   

   

   

   

   

   

   

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


Re: [python-win32] Windows 10

2015-10-26 Thread Zachary Turner via python-win32
It's not that "many programmers still refer to Windows API as Win32", it's
that the Windows API itself has decided that that is what it is called.
When you #define _WIN32 in a C or C++ program using the Windows API, it
does not mean "this is a 32-bit app", it means "I'm using the Windows
API".  That's why you still define this even in 64-bit builds, for example,
where you #define both _WIN32 and _WIN64.

You're not wrong, but it's just that the problem goes deeper than what you
make it sound :)  The Windows API *is* the Win32 API and vice versa.  They
are synonyms.

On Sun, Oct 25, 2015 at 11:24 PM eryksun  wrote:

> On 10/25/15, Laura Creighton  wrote:
> >
> > Can I suggest a mailing list name change to reflect 64 bit windows?
> > python-windows would be my suggestion ....
>
> I agree. This list is about programming in Python on Windows, so
> python-windows is an obvious name and one that a novice programmer can
> easily recognize.
>
> I think the name has yet to change because a lot of programmers still
> refer to the Windows API as "Win32" instead of "WinAPI". Also, the
> system directory on 64-bit Windows is still called "System32", and
> many of the more well-known system DLLs still have "32" in the name,
> such as the following:
>
> shell32, ole32, kernel32, crypt32, opengl32,
> user32, advapi32, win32spl, comctl32, comdlg32,
> gdi32, rasapi32, w32time, wldap32, ws2_32,
> tapi32, cfgmgr32, imm32, msvfw32, clfsw32,
> netapi32, wtsapi32, mssign32, secur32, riched32
> ___
> python-win32 mailing list
> python-win32@python.org
> https://mail.python.org/mailman/listinfo/python-win32
>
___
python-win32 mailing list
python-win32@python.org
https://mail.python.org/mailman/listinfo/python-win32


Re: [python-win32] Building my own C extension

2015-11-04 Thread Zachary Turner via python-win32
Two questions:

1) Are you embedding this extension in your own application or do you only
need to be able to load it into a stock Python distribution?
2) Is Python 3.5 out of the question?

On Wed, Nov 4, 2015 at 5:10 PM Ken Brooks  wrote:

> I have joined this list because I need to learn how to rebuild my
> antiquated Python extension properly for Windows. I need to build for
> Python 2.7, which is old and relies upon old compilers. I downloaded the
> suggested compiler:
>
>
> http://download.microsoft.com/download/A/5/4/A54BADB6-9C3F-478D-8657-93B3FC9FE62D/vcsetup.exe
>
> I downloaded the thing that is supposed to correctly glue it to Python:
>
>
> https://download.microsoft.com/download/7/9/6/796EF2E4-801B-4FC4-AB28-B59FBF6D907B/VCForPython27.msi
>
> But I can't see where to go from there.
>
> In my old world I never actually learned how to use distutils or
> setuptools; I was just building my extension with my VC and then shoving it
> into site-packages. As I read the documentation for distutils and
> setuptools, I am SO LOST! I see much about how to install someone else's
> package, but little about how to create and script my own package for
> building a Python extension written in C. Please, can someone point me to a
> good sample extension package that I can copy from?  A "hello world" or
> something?
>
> Apart from that, can someone please point me to the documentation for the
> current "right" way of building things, as an extension developer?
>
> Thanks in advance,
>
> Ken
> _______
> python-win32 mailing list
> python-win32@python.org
> https://mail.python.org/mailman/listinfo/python-win32
>
___
python-win32 mailing list
python-win32@python.org
https://mail.python.org/mailman/listinfo/python-win32


Re: [python-win32] Figuring out why a window is losing focus

2016-02-07 Thread Zachary Turner via python-win32
Why do you need to use Python?  Sounds like this is done very easily with
Spy++

On Sun, Feb 7, 2016 at 10:12 AM Ram Rachum  wrote:

> Hi everybody,
>
> There's a problem in my Windows 7 machine that I want to diagnose using
> Python.
>
> Once in a while, I'm noticing that focus is being stolen from the active
> window and then immediately given back. For example, right now as I'm
> writing this message to you in GMail, I see that the window title, once in
> about 5 seconds, changes its color rapidly from active to inactive and then
> to active again. This happens not only in Chrome but in any program. It
> doesn't always happen, but it's been happening on some days during the last
> few months. This is really annoying because if I opened a dropdown, for
> example, this action makes the dropdown disappear. Another example is that
> if I'm renaming a file in explorer, when the event happens it's as if I
> pressed "enter" and the file gets the partial name before I finished
> typing.
>
> I'm guessing that some app that's installed on my computer is causing
> this, but I don't know which one. I want to use Python to figure out which
> one. I want to set Python up to listen to WM_ACTIVATE events (or any other
> kind of events? Please let me know) and write a log saying which program
> the focus was passed to. I'm hoping that this way I can find the offending
> program.
>
> I have no idea how to write a thing like this in Python, and whether this
> is even possible. Can you please help me?
>
>
> Thanks for your help,
> Ram Rachum.
> ___
> python-win32 mailing list
> python-win32@python.org
> https://mail.python.org/mailman/listinfo/python-win32
>
___
python-win32 mailing list
python-win32@python.org
https://mail.python.org/mailman/listinfo/python-win32


Re: [python-win32] Figuring out why a window is losing focus

2016-02-07 Thread Zachary Turner via python-win32
You can log the messages going to a particular window.  Just click Spy ->
Log Messages.  But it occurred to me you want to know *which* process is
sending the message.  I don't believe there's a way to do that short of
hooking the native PostMessage and SendMessage Win32 APIs in every process
running on the system.


On Sun, Feb 7, 2016 at 1:19 PM Ram Rachum  wrote:

> Thanks for the reference to Spy++! I'm checking it out and it looks like a
> useful program. But I don't understand, how do I use it to accomplish what
> I wanted?
>
> On Sun, Feb 7, 2016 at 10:39 PM, Zachary Turner 
> wrote:
>
>> Why do you need to use Python?  Sounds like this is done very easily with
>> Spy++
>>
>> On Sun, Feb 7, 2016 at 10:12 AM Ram Rachum  wrote:
>>
>>> Hi everybody,
>>>
>>> There's a problem in my Windows 7 machine that I want to diagnose using
>>> Python.
>>>
>>> Once in a while, I'm noticing that focus is being stolen from the active
>>> window and then immediately given back. For example, right now as I'm
>>> writing this message to you in GMail, I see that the window title, once in
>>> about 5 seconds, changes its color rapidly from active to inactive and then
>>> to active again. This happens not only in Chrome but in any program. It
>>> doesn't always happen, but it's been happening on some days during the last
>>> few months. This is really annoying because if I opened a dropdown, for
>>> example, this action makes the dropdown disappear. Another example is that
>>> if I'm renaming a file in explorer, when the event happens it's as if I
>>> pressed "enter" and the file gets the partial name before I finished
>>> typing.
>>>
>>> I'm guessing that some app that's installed on my computer is causing
>>> this, but I don't know which one. I want to use Python to figure out which
>>> one. I want to set Python up to listen to WM_ACTIVATE events (or any other
>>> kind of events? Please let me know) and write a log saying which program
>>> the focus was passed to. I'm hoping that this way I can find the offending
>>> program.
>>>
>>> I have no idea how to write a thing like this in Python, and whether
>>> this is even possible. Can you please help me?
>>>
>>>
>>> Thanks for your help,
>>> Ram Rachum.
>>> ___
>>> python-win32 mailing list
>>> python-win32@python.org
>>> https://mail.python.org/mailman/listinfo/python-win32
>>>
>>
>
___
python-win32 mailing list
python-win32@python.org
https://mail.python.org/mailman/listinfo/python-win32


Re: [python-win32] Figuring out why a window is losing focus

2016-02-08 Thread Zachary Turner via python-win32
It's included as part of Visual Studio.  Download community edition, it
should be there.

On Mon, Feb 8, 2016 at 7:33 PM reckoner  wrote:

>
> Where can I safely download this Spy program you are all talking about?
>
> Thanks!
>
>
>
> On 2/8/2016 9:00 AM, python-win32-requ...@python.org wrote:
> > Re: Figuring out why a window is losing focus
> _______
> python-win32 mailing list
> python-win32@python.org
> https://mail.python.org/mailman/listinfo/python-win32
>
___
python-win32 mailing list
python-win32@python.org
https://mail.python.org/mailman/listinfo/python-win32


[python-win32] Problem: methods defined in type library's base class are not accessible in inherited class objects of the type library

2016-02-18 Thread Indranil Sinharoy via python-win32

Hi all,

I am a relatively new user of pywin32 package, but not Python. I have an 
application (written in C/#, as I understand) that provides a COM 
interface for using with other languages such as Python. I am using the 
pywin32 library to communicate with the application and it works fairly 
well. However, I am facing a particular kind of problem. The problem is 
that the application exposes some interface objects that inherit from 
other base objects but the methods defined in the base class objects 
doesn't seem to be accessible to the child class object. Is this type of 
behavior is atypical with pywin32? If so, what is the recommended way of 
addressing this problem? Currently, I am patching these methods in the 
child class object and delegating the calls to the parent object (using 
CastTo)) as shown in the pseudo-code below:


class MyBaseClass:
...
...
def my_parent_method(self):
base = win32com.client.CastTo(self, 'MyParentClass')
return base.my_parent_method()
...


Although this strategy works, I would like to find out if there is a 
more efficient/ automatic way of resolving this  issue.  In my 
particular case, there are a large number of such objects (that inherit 
from some base class without access to the methods defined in the parent 
class) provided by the application and I would like to avoid re-writing 
all the methods for all such objects.


I hope I have been able to explain my problem well.

Thank you very much,
Best regards,
Indranil.
___
python-win32 mailing list
python-win32@python.org
https://mail.python.org/mailman/listinfo/python-win32


[python-win32] Python in Visual Studio

2016-04-16 Thread Mark Lawrence via python-win32
For anybody who might be interested this is a podcast featuring Steve 
Dower from Microsoft 
https://talkpython.fm/episodes/show/53/python-in-visual-studio


--
My fellow Pythonistas, ask not what our language can do for you, ask
what you can do for our language.

Mark Lawrence

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


Re: [python-win32] Python in Visual Studio

2016-04-16 Thread Zachary Turner via python-win32
The debugger is good too. I don't know of any other tool that lets you
seamlessly step between Python and native code when debugging a program
which embeds Python
On Sat, Apr 16, 2016 at 5:23 PM Alexander Walters 
wrote:

> As a total aside, PTVS (part of the base VS 2015 install, IIRC) is now
> my editor of choice when editing python on windows, edging out gvim
> (...primarily because you can make vim bindings work in VS). It is a
> really good editor, with really good code completion features... which
> makes sense, considering how much money microsoft spent on intelisense.
>
> On 4/16/2016 16:56, Mark Lawrence via python-win32 wrote:
> > For anybody who might be interested this is a podcast featuring Steve
> > Dower from Microsoft
> > https://talkpython.fm/episodes/show/53/python-in-visual-studio
> >
>
> _______
> python-win32 mailing list
> python-win32@python.org
> https://mail.python.org/mailman/listinfo/python-win32
>
_______
python-win32 mailing list
python-win32@python.org
https://mail.python.org/mailman/listinfo/python-win32


  1   2   >