| Struggling with python & XP again. My app needs to know if a
| certain program is running on my XP box
As a complete alternative, consider using WMI:
import os, sys
import wmi
c = wmi.WMI ()
for process in c.Win32_Process (Name="excel.exe"):
print "Excel is running"
break
else:
print "
> Very interesting. But what is "duckly-typed"? I'm so dumb I can't
> distinguish between a typo and a technical term..
>
> Dick Moores
>
>
Refer to the Wikipedia article on Duck Typing:
http://en.wikipedia.org/wiki/Duck_typing
Basically, if you saw my example earlier of substituting stdout:
[Tim Golden]
| > This link may get you started:
| >
| > http://effbot.org/pyfaq/how-do-i-emulate-os-kill-in-windows.htm
| >
| > although it may not apply, depending on the exact
| > circumstances of what you're doing.
[Paulino]
| Thank you Tim,
|
| How do i get the pid of the process?
I'm going
On Tue, 05 Dec 2006 22:18:02 -0800
Dick Moores <[EMAIL PROTECTED]> wrote:
> Say I have a function,
>
> def my_function(max, min=0):
> return max - min
>
> The order of arguments is counterintuitive, but it seems it can't be
> changed if I want to have a default min. Is there way to write
>
Dave S wrote:
> Hi all,
>
> Struggling with python & XP again. My app needs to know if a certain program
> is running on my XP box
>
> Ideal world - I can get the output of 'tasklist.exe' into a string.
>
> I have tried
>
> os.execl('')
> It throws the output to the terminal + I need the e
Hello,
I am trying to write a very simple py-opengl program pair causing a
variable in each program to be changed by the other. I am able to open
a command window in which I manually assign a value to the variable, but
I cannot seem to implement the udp/ip information I wish to send into a
f
On Tuesday 05 December 2006 23:32, Alan Gauld wrote:
> "Dave S" <[EMAIL PROTECTED]> wrote
>
> > Struggling with python & XP again. My app needs to know if a certain
> > program
> > is running on my XP box
> >
> > os.execl('')
> > It throws the output to the terminal + I need the exact path to t
On Wednesday 06 December 2006 08:48, Tim Golden wrote:
> | Struggling with python & XP again. My app needs to know if a
> | certain program is running on my XP box
>
> As a complete alternative, consider using WMI:
>
>
> import os, sys
> import wmi
>
> c = wmi.WMI ()
> for process in c.Win32_Proce
On Wednesday 06 December 2006 11:04, Kent Johnson wrote:
> Dave S wrote:
> > Hi all,
> >
> > Struggling with python & XP again. My app needs to know if a certain
> > program is running on my XP box
> >
> > Ideal world - I can get the output of 'tasklist.exe' into a string.
> >
> > I have tried
> >
[Dave S]
| Just looked at WMI - didn't know it existed !
| Am going down the subprocess route first as its 'built in'.
| If that does not work - hello WMI
Personally, I find having both (and other) tools
in my toolbelt useful -- I've just answered another
question elsewhere about starting and st
At 02:28 AM 12/6/2006, Michael Lange wrote:
>On Tue, 05 Dec 2006 22:18:02 -0800
>Dick Moores <[EMAIL PROTECTED]> wrote:
>
> > Say I have a function,
> >
> > def my_function(max, min=0):
> > return max - min
> >
> > The order of arguments is counterintuitive, but it seems it can't be
> > change
On Wednesday 06 December 2006 11:43, Dave S wrote:
> On Tuesday 05 December 2006 23:32, Alan Gauld wrote:
> > "Dave S" <[EMAIL PROTECTED]> wrote
> >
> > > Struggling with python & XP again. My app needs to know if a certain
> > > program
> > > is running on my XP box
> > >
> > > os.execl('')
>
At 01:07 AM 12/6/2006, Luke Paireepinart wrote:
> > Very interesting. But what is "duckly-typed"? I'm so dumb I can't
> > distinguish between a typo and a technical term..
> >
> > Dick Moores
> >
> >
>Refer to the Wikipedia article on Duck Typing:
>http://en.wikipedia.org/wiki/Duck_typing
Thanks,
I wrote this function:
def numberRounding(n, significantDigits=4):
"""
Rounds a number (float or integer, negative or positive) to any number
of
significant digits. If an integer, there is no limitation on it's size.
"""
import decimal
def d(x):
Dick Moores wrote:
> I wrote this function:
>
> def numberRounding(n, significantDigits=4):
> """
> Rounds a number (float or integer, negative or positive) to any number
> of
> significant digits. If an integer, there is no limitation on it's size.
> """
> import de
Hi all,
I have a python script (with endless loop) and i want to
start it from the rc.config file. So, the question is: how
to covert this script to work as daemon ... or how to start
the python interpreter ... to work as background process ?
E.
-
Спортни залагани
At 05:35 AM 12/6/2006, Kent Johnson wrote:
>Dick Moores wrote:
>>I wrote this function:
>>def numberRounding(n, significantDigits=4):
>> """
>> Rounds a number (float or integer, negative or positive)
>> to any number of
>> significant digits. If an integer, there is no lim
[EMAIL PROTECTED] schrieb:
>
> Hi all,
>
> I have a python script (with endless loop) and i want to
> start it from the rc.config file. So, the question is: how
> to covert this script to work as daemon ... or how to start
> the python interpreter ... to work as background process ?
Search googl
> > How can I check if a variable is an integer?
>
> Luke and John have answered your question, but we should also
> ask, why
> do you want to do that? Explicit type testing is a code
> smell, perhaps
> there is a better way to do what you want.
>
> Kent
>
Kent,
Can you explain further? Re
Hey, friendly person who took the time to read this!
I'm cutting right to the case. Trying to get certain information into Excel.
However, I can't:
from win32com.client import Dispatch
xlApp = Dispatch("Excel.Application")
# continues
As soon as I start the program, I get a error: win32com.cli
[Toon Pieton]
| As soon as I start the program, I get a error:
| win32com.client not found. This - of course - leads to the
| conclusion that I don't have the win32com module installed. I
| tried to find it (Google), but all I could find when
| searching for "python win32 module (download)", I
Hi all,
I thought I had my solution with subprocess ... my test code ...
#!/usr/bin/env python
# -*- coding: iso8859_1 -*-
import subprocess
a = subprocess.Popen('tasklist.exe', bufsize=0, stdout=subprocess.PIPE,
universal_newlines=True)
op = a.stdout.readlines()
for i in op:
i
Toon Pieton wrote:
> Hey, friendly person who took the time to read this!
>
> I'm cutting right to the case. Trying to get certain information into
> Excel. However, I can't:
>
> from win32com.client import Dispatch
>
> xlApp = Dispatch("
> Excel.Application")
> # continues
>
> As soon as I st
Mike Hansen wrote:
>>> How can I check if a variable is an integer?
>> Luke and John have answered your question, but we should also
>> ask, why
>> do you want to do that? Explicit type testing is a code
>> smell, perhaps
>> there is a better way to do what you want.
>>
>> Kent
>>
>
> Kent,
>
Tim Golden wrote:
> Using win32com and Excel is very easy, but there
> are alternatives if you want:
>
> http://cheeseshop.python.org/pypi/xlrd/0.5.2
xlrd is for reading only - OP wants to write Excel files.
Kent
___
Tutor maillist - Tutor@python.o
[Kent Johnson]
| Tim Golden wrote:
| > Using win32com and Excel is very easy, but there
| > are alternatives if you want:
| >
| > http://cheeseshop.python.org/pypi/xlrd/0.5.2
|
| xlrd is for reading only - OP wants to write Excel files.
Oops! Quite right. I was moving a bit too fast. Sorry, OP
Hi folks,
I have a problem with drawing a BAR-chart. I am drawing a HORIZONTAL bar
chart. I did manage to sort out the length issue of individual bars (with
the help of inputs from this forum's members).
What I want is the height of the bar chart should be determined dynamically
(basically it m
Toon Pieton wrote:
> Hey Kent,
>
> Thanks for your reply. Can you suggest which module I should look at?
> And can I make diagrams using that module?
Assuming you are asking about modules for writing CSV files, then look
at the csv module. CSV (comma-separated value) is a simple text format
th
I'm new to programming, and trying to learn the Python language.
The following code does what I want it to do, but I have not idea how it
works.
def scanList(names,temp):
for i in names:
temp[i] = 0
print temp
Names = []
temp = {}
I have a list of names (Names[]) and want to
Hey friendly users!
I'm trying to make a simple program to calculate the odds when playing
poker. The idea is that you select both your cards from listboxes. However,
no matter what I try, I just can't select a entry in either of the
listboxes! I can click all I want, it just won't select. Here's
> -Original Message-
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On Behalf Of Morpheus
> Sent: Wednesday, December 06, 2006 9:00 AM
> To: tutor@python.org
> Subject: [Tutor] List to dictionary question
>
> I'm new to programming, and trying to learn the Python language.
> T
On Wed, 06 Dec 2006 04:29:54 -0800
Dick Moores <[EMAIL PROTECTED]> wrote:
(...)
> >
> >def my_function(min, max=None):
> > if max is None:
> > max = min
> > min = 0
> > # stuff
>
> Great!
>
> >I am not sure if this is more intuitive though.
>
> >>>
> def my_function(min
Try ID's higher then 1 ... low ID's are usually taken by
wxWidgets. To be safe simply create them with wx.ID_ANY (from the top
of my head) and after that:
self.box1.Bind(wx.EVT_LISTBOX, self.b1func,id=self.box1.GetId())
Which is a bit more dynamic anyway and saves you some constants.
Further
Hi Folks,
I'm working through Magnus Lie Hetland's excellent book "Beginning
Python" and I have a few basic (I think) questions. Specifically,
regarding his first project in Chapter 20 (Instant Markup).
The outline of the project is to take a plain text file and "mark it
up" into HTML or XML.
"Asrarahmed Kadri" <[EMAIL PROTECTED]> wrote in
> What I want is the height of the bar chart should be determined
> dynamically
> (basically it means the length of the Y-axis), as per the number of
> data-items being displayed.
Hmm, I thought we ansdwered this recently...
Anyhow you just calcu
Hi Folks,
I'm working through Magnus Lie Hetland's excellent book "Beginning
Python" and I have a few basic (I think) questions. Specifically,
regarding his first project in Chapter 20(Instant Markup).
The outline of the project is to take a plain text file and "mark it
up" into HTML or XML.
I got that point, what I want is how the dimensions of the canvas would be
adjusted so as to incorporate this Y-axis variable length?
Do I need a scrollbar for that??
Thanks in advance.
Regards,
Asrarahmed Kadri
On 12/6/06, Alan Gauld <[EMAIL PROTECTED]> wrote:
"Asrarahmed Kadri" <[EMAIL PR
> def lines(file):
>for line in file: yield line
>yield '\n'
>
> del blocks(file):
>block = []
>for line in lines(file):
>if line.strip():
> block.append(line)
>elif block:
> yield ''.join(block).strip()
> block = []
>
> 1.) Does the yie
Hi,
I am using beautiful soup to get links from an html document.
I found that beautiful Soup changes the & in the links to & due to which
some of the links become unusable.
Is there any way I could stop this behaviour?
Regards,
Shitiz
-
Access over 1 million so
Am 05.12.2006 um 09:44 schrieb Anders Persson:
> Hi!
>
> I try to learn my son Development using Python.
> I have found that drPython was a great enviroment and easy for him to
> understand.
>
> Is't a problem running om Macintosh OS/X i have to start on
> commandline,
> OS/X
> dosen't understan
Hi Wesley,
Thank you very much for the feeback. It helped a lot!
Quoting wesley chun <[EMAIL PROTECTED]>:
>> def lines(file):
>>for line in file: yield line
>>yield '\n'
>>
>> del blocks(file):
>>block = []
>>for line in lines(file):
>>if line.strip():
>> bloc
On Wednesday 06 December 2006 13:29, Dick Moores wrote:
> I meant that the order "min, max" is more intuitive than "max,
> min". Don't you agree? And it's the order used in random.randint(),
> random.randrange(), and random.uniform(), for examples.
What about two intuitively named functions, like
--- Asrarahmed Kadri <[EMAIL PROTECTED]> wrote:
> I got that point, what I want is how the dimensions of the
> canvas would be
> adjusted so as to incorporate this Y-axis variable length?
>
You provide the size of the canvas when you create
it normally. But you can use at least 2 approaches.
Is this something I can do using just python and libraries? I know I could
automate other utilities, but I'd like to write some kind of neat utility
myself that I could play with for more experience.
Goal:
make USB drive bootable to a dos prompt (dont care what dos, assuming I need
a bootable ima
Dave S wrote:
> Hi all,
>
> I thought I had my solution with subprocess ... my test code ...
>
>
>
> #!/usr/bin/env python
> # -*- coding: iso8859_1 -*-
>
> import subprocess
>
> a = subprocess.Popen('tasklist.exe', bufsize=0, stdout=subprocess.PIPE,
> universal_newlines=True)
> op = a.s
Is there any good tutorial about numeric python for beginners?
I have googled around and many of them are either too old or aims at
experienced users...
Thanks,
Linda
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
I'm new to programming, and trying to learn the Python language.
The following code does what I want it to do, but I have not idea how it
works.
def scanList(names,temp):
for i in names:
temp[i] = 0
print temp
Names = []
temp = {}
I have a list of names (Names[]) and want to
On Wed, Dec 06, 2006 at 05:49:22PM -0800, linda.s wrote:
> Is there any good tutorial about numeric python for beginners?
> I have googled around and many of them are either too old or aims at
> experienced users...
Look here:
http://new.scipy.org/Wiki/Documentation
Dave
--
Dave Kuhlman
ht
On Wed, Dec 06, 2006, Morpheus wrote:
>I'm new to programming, and trying to learn the Python language.
>The following code does what I want it to do, but I have not idea how it
>works.
>
>def scanList(names,temp):
>for i in names:
>temp[i] = 0
>print temp
>
>Names = []
>temp =
>> I have a list of names (Names[]) and want to remove duplicate names in
>> the list. [snip]
>>
>
> The way I usually do this is something like:
>
> outDict = dict(map(lambda x: (x, 1), inList))
> names = outDict.keys()
> names.sort()
>
How about this :D
# Remove duplicates from a list:
At 09:53 PM 12/6/2006, Luke Paireepinart wrote:
> >> I have a list of names (Names[]) and want to remove duplicate names in
> >> the list. [snip]
> >>
> >
> > The way I usually do this is something like:
> >
> > outDict = dict(map(lambda x: (x, 1), inList))
> > names = outDict.keys()
> > names.so
51 matches
Mail list logo