Re: [python-win32] detecting windows type

2005-09-09 Thread le dahut
Maybe I can parse the output of a 'ipfonfig' command, but
commands.getoutput only work with unix, not with windows. Is there
another way to get the output of a command line program under windows ?

K.

Le jeudi 08 septembre 2005 à 17:24 +0200, Peter Jessop a écrit :
 
 
 On 9/8/05, le dahut [EMAIL PROTECTED] wrote:
 
 Hello,
 
 How is it possible to detect which kind of windows a python script
 is
 running on ? (9x, Me, 2k, XP, 2k3)
 
 
   from win32api import *
  GetVersionEx()
 
 
 
 An other question:
 I've a script using
 win32com.client.Dispatch(WbemScripting.SWbemLocator) but it
 doesn't
 seem to function on win 9x. This script is intended to detect the
 computer's network configuration (gateway, dns, ip addr, subnet
 mask).
 Does someone know how to obtain those informations on a win 9x ?
 
 
 Windows 9x came without support for WMI. You can download WMI Core
 from
 http://www.microsoft.com/downloads/details.aspx?FamilyId=98A4C5BA-337B-4E92-8C18-A63847760EA5displaylang=en
 although the implementation is quite limited
 
 Regards
 
 Peter Jessop


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


[python-win32] Localization

2005-09-09 Thread Bokverket
Hi, new to the list and to Python but enthusiastically on the move into both...

I am from the world outside A-Za-z country. I wrote a simple text processing 
application in Python which I eventually would like to
integrate with Microsoft Word. Right away, the following localization problems 
popped up:

-- Sorting is done incorrectly for non-a-z letters.
-- Using \W for whitespace in a regular expression makes it treat those non-a-z 
letters as whitespace, thus breaking words that
should not be broken.
-- Not yet sure if folding to lower-case is done correctly.

How should I handle this in Python?   I post on this list, since Windows by 
itself has good support for localization (altering the 
sorting sequence etc) as you know, though I am not familiar with the Windows 
calls for this.
Best,
___
Python-win32 mailing list
Python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32


[python-win32] handling paths in windows services

2005-09-09 Thread Jason
I get the following error when trying to run a python script as a service

The instance's SvcRun() method failed 
  File win32serviceutil.pyc, line 742, in SvcRun
  File winService.pyc, line 134, in SvcDoRun
  File winService.pyc, line 83, in RunMe
  File config.pyc, line 28, in readConfig
exceptions.IOError: (2, 'No such file or directory', 'svc.cfg')

The 'svc.cfg' is on the the same directory that contains the python
script, but its path is obviously not available to the windows
service. Short of using absolute paths, what would be the correct way
to handle this.

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


[python-win32] path to START MENU folder

2005-09-09 Thread Chavez Gutierrez, Freddy
Title: path to START MENU folder





Somewhere I found this code to get the path to the DESKTOP folder:


 from win32com.shell import shell
 df = shell.SHGetDesktopFolder()
 pidl = df.ParseDisplayName(0, None,::{450d8fba-ad25-11d0-98a8-0800361b1103})[1]
 mydocs = shell.SHGetPathFromIDList(pidl)
 print mydocs


When I execute it, I get this: C:\Documents and Settings\freddy\My Documents.


That's ok. Now, I want to get the START MENU folder for all users, which is something like: C:\Documents and Settings\All Users\Start Menu.

Thanks for your help.


Regards,
Freddy Chavez.



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


[python-win32] Re: path to START MENU folder

2005-09-09 Thread Roger Upole
shell.SHGetSpecialFolderPath(0,shellcon.CSIDL_COMMON_STARTMENU)
should do the trick.

Roger




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


[python-win32] path to START MENU folder

2005-09-09 Thread Peter Jessop
Hola Freddy

Another way of doing it would be to use the WScript.Shell object:

import win32com.client
objShell = win32com.client.Dispatch(WScript.Shell)
allUserDocs = objShell.SpecialFolders(AllUsersDesktop)
print allUserDocs

similarly you can use the following to obtain access to other special folders:
AllUsersDesktop,AllUsersStartMenu,AllUsersPrograms,AllUsersStartupDesktop,Favorites,Fonts,MyDocuments,NetHood,PrintHood,Recent,SendToStartMenu,Startup  Templates
Saludos

Peter Jessop


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


Re: [python-win32] detecting windows type

2005-09-09 Thread Tim Roberts
On Fri, 09 Sep 2005 09:42:18 +0200, le dahut [EMAIL PROTECTED] wrote:

Maybe I can parse the output of a 'ipfonfig' command, 


Nope, that won't work.  Ipconfig is NT-only.  95 and 98 have winipcfg, 
but it is a GUI tool, not a command-line tool.

but commands.getoutput only work with unix, not with windows. Is there
another way to get the output of a command line program under windows ?


The usual way is to use os.popen, which works everywhere.  However, as I 
said, that won't help you with this information.

In fact, it is surprisingly difficult to get information about the 
network interfaces on a 95/98 machine.  Have you tried the downloadable 
WMI support mentioned earlier?

-- 
Tim Roberts, [EMAIL PROTECTED]
Providenza  Boekelheide, Inc.

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


Re: [python-win32] handling paths in windows services

2005-09-09 Thread Gabriel Genellina
At Friday 9/9/2005 11:08, you wrote:

The 'svc.cfg' is on the the same directory that contains the python
script, but its path is obviously not available to the windows
service. Short of using absolute paths, what would be the correct way
to handle this.

Try this:

import os,sys
print os.path.join(
 os.path.dirname(
   os.path.abspath(
 sys.argv[0])),
 'svc.cfg')



Gabriel Genellina
Softlab SRL 

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