Alan,
The problem is that I have another tool that has an initialization period when
you start it up. I want to see how long it takes for it to start up or
initialize. So, I set up the tool to startup and after it finishes the init
stage, load up a file which has a custom procedure. Then run thi
On 10/27/07, Alan Gauld <[EMAIL PROTECTED]> wrote:
>
> "linda.s" <[EMAIL PROTECTED]> wrote
>
> >I have a string a= "qq,eee,rrr".
> a.index(",")
> > 2
> > It is the position of the first "," in a.
> > Is that possible to find the Nth "," in a if a is a very long string
> > and I need know the p
At 04:06 PM 10/27/2007, Alan Gauld wrote:
>"Dick Moores" <[EMAIL PROTECTED]> wrote
>
> >> Hence if type(n) is already long it does not have to get converted
> >> to int to accommodate something small.
> >
> > And that's not a bug?
>
>No its expected behaviour.
>If you start with a float and add an
On Thu Oct 25 06:45:38 CEST 2007, Lawrence Shafer wrote:
> I am trying to convert a program with hand coded QT over to using UI
> files from QT Designer. I am getting the error below and do not
> understand what's going on.
This error occurs when an object referred to by Python and Qt is delete
At 11:34 AM 10/27/2007, Dave Kuhlman wrote:
>On Sat, Oct 27, 2007 at 01:03:18PM +0100, Alan Gauld wrote:
>
> > if type(n) == int
> >
> > Or just use an instance of the same type:
> >
> > if type(n) == type(42)
>
>Calling type(n) for any integer seems to return the same object.
>I checked with id().
> This looks to me like the Tix DLL hasn't been installed or it's
> installed in a folder where it can''t be found. The Tix module
> is just a wrapper round the Tix DLL so you need both.
>
> I wonder where should I install Tix DLL
I'd look for the other DLLs in the Python tree or alternatively
p
"linda.s" <[EMAIL PROTECTED]> wrote
>I have a string a= "qq,eee,rrr".
a.index(",")
> 2
> It is the position of the first "," in a.
> Is that possible to find the Nth "," in a if a is a very long string
> and I need know the position of the Nth ","?
Yes but not directly.
index takes a couple
"John" <[EMAIL PROTECTED]> wrote
> for i in attempts: #attempts holds strings of shellscripts
>cmd="%s which runs many different shell scripts and takes
> about an
> hour" % (i)
>os.system(cmd)
>#debugging
>print "Finished with %s" % (i)
>raw_input("More
"Dick Moores" <[EMAIL PROTECTED]> wrote
>> Hence if type(n) is already long it does not have to get converted
>> to int to accommodate something small.
>
> And that's not a bug?
No its expected behaviour.
If you start with a float and add an integer the result is a float.
Why should long act any
"Eric Walker" <[EMAIL PROTECTED]> wrote
> I am trying to run a timing script but I need the python program
> to stop and wait for the executable to finish. Does anyone have
> any examples of doing this?
There are several ways to do it depending on what exactly
you are trying to do. We need a
"Dick Moores" <[EMAIL PROTECTED]> wrote
> n = 100
You start with n as a long.
> print type(n)
> while True:
> if type(n) == long:
> n -= 100
A long minus an int gives a long:
>>> n = long(42)
>>> n
42L
>>> n - 3
39L
So n never changes into an int even though it is wit
"Dave Kuhlman" <[EMAIL PROTECTED]> wrote
> Calling type(n) for any integer seems to return the same object.
> I checked with id().
I would hope so since they are all of the same type.
It thus makes sense that they all return a reference to
the same type object.
> So, should we be using:
>
>
"John" <[EMAIL PROTECTED]> wrote
>I have a file sitelocations:
>
> STN_id[1]=AAA
> STNlat[1]=58.80
> STNlon[1]=17.40
> STNelv[1]=20
> STN_id[2]=BBB
> STNlat[2]=42.45
> STNlon[2]=25.58
> STNelv[2]=2925
>
> which in shell scripts I can simple 'source'.
> In Python I have to:
>
John wrote:
> I have the exact same situation, but system doesn't seem to wait. Here
> is my pseudo code:
>
> for i in attempts: #attempts holds strings of shellscripts
> cmd="%s which runs many different shell scripts and takes about
> an hour" % (i)
> os.system(cmd)
> #d
How about using subprocess.Popen( ... ).wait()?
I believe subprocess.call() will wait until the process is finished,
too.
The subprocess module is meant to replace spawn, popen2, os.system()
etc. if I'm not mistaken.
Take a look at this excellent resource I've used numerous times:
http://ww
I have the exact same situation, but system doesn't seem to wait. Here is my
pseudo code:
for i in attempts: #attempts holds strings of shellscripts
cmd="%s which runs many different shell scripts and takes about an
hour" % (i)
os.system(cmd)
#debugging
print "Fini
I have a string a= "qq,eee,rrr".
>>> a.index(",")
2
It is the position of the first "," in a.
Is that possible to find the Nth "," in a if a is a very long string
and I need know the position of the Nth ","?
Thanks,
Linda
___
Tutor maillist - Tutor@pyth
On 10/26/07, Alan Gauld <[EMAIL PROTECTED]> wrote:
> Linda,
>
> >I run the following code in Python 2.5 and got the error (when I do
> > "import Tix", no error).
>
> Congratulations I think this might just be the first Tix question
> on the tutor list! :-)
>
> > Traceback (most recent call last):
>
On Sat, Oct 27, 2007 at 01:03:18PM +0100, Alan Gauld wrote:
>
> "Dick Moores" <[EMAIL PROTECTED]> wrote
>
> > if type(n) == 'int' or type(n) == 'long':
> > do something
>
> don't use strings
>
> if type(n) == int
>
> Or just use an instance of the same type:
>
> if type(n) == type(42)
Call
disregard this one. I found the answer. I was using spawn instead of os.system.
Thanks.
- Original Message
From: Eric Walker <[EMAIL PROTECTED]>
To: tutor@python.org
Sent: Saturday, October 27, 2007 9:55:05 AM
Subject: [Tutor] system call
Hello,
I am trying to run a timing script but
Thanks,
it's strange, it works within a script defined at the top, but if I try to
import it from a module it fails:
NameError: name 'files' is not defined
On 10/27/07, Aditya Lal <[EMAIL PROTECTED]> wrote:
>
>
>
> On 10/27/07, John <[EMAIL PROTECTED]> wrote:
> >
> > Note, i need the ns+1 beca
At 10:27 AM 10/27/2007, Jeff Younker wrote:
>On Oct 27, 2007, at 12:52 PM, Dick Moores wrote:
>>At 08:39 AM 10/27/2007, Aditya Lal wrote:
>>> Hence if type(n) is already long it does not have to get converted
>>>to int to accommodate something small.
>>
>>And that's not a bug?
>
>There is no need
On Oct 27, 2007, at 12:52 PM, Dick Moores wrote:
> At 08:39 AM 10/27/2007, Aditya Lal wrote:
>> Hence if type(n) is already long it does not have to get converted
>> to int to accommodate something small.
>
> And that's not a bug?
There is no need for a type change to represent zero, so, no, that
On 10/27/07, John <[EMAIL PROTECTED]> wrote:
>
> Note, i need the ns+1 because the 'source files are not zero indexed.
>
> On 10/27/07, John <[EMAIL PROTECTED] > wrote:
> >
> > Here's where I am:
> >
> >
> > def source(filename, vList):
> > """ takes a file object and a list of variables as input
Hello,
I am trying to run a timing script but I need the python program to stop and
wait for the executable to finish. Does anyone have any examples of doing this?
Thanks
Python Newbie
__
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best s
At 08:39 AM 10/27/2007, Aditya Lal wrote:
>I would expect that a type change will happen if there is a need.
Hey, I HAD a need! OK, a made-up one.
> Hence if type(n) is already long it does not have to get converted
> to int to accommodate something small.
And that's not a bug?
>I changed you
Note, i need the ns+1 because the 'source files are not zero indexed.
On 10/27/07, John <[EMAIL PROTECTED]> wrote:
>
> Here's where I am:
>
>
> def source(filename, vList):
> """ takes a file object and a list of variables as input """
> import re
> # Read the file
> fid=open(filename,'r')
>
Here's where I am:
def source(filename, vList):
""" takes a file object and a list of variables as input """
import re
# Read the file
fid=open(filename,'r')
lines = fid.readlines()
fid.close()
#how many variables
ns=len(lines)/len(vList)
#predefine the varibles
for v in vList:
exec(
On 10/27/07, Dick Moores <[EMAIL PROTECTED]> wrote:
>
> Win XP, Python 2.5.1
>
>
> #!/usr/bin/env python
> #coding=utf-8
>
> n = 100 # 10 billion
> print "type of 10 billion is", type(n)
> n = 10 # 1 billion
> print "type of 1 billion is", type(n)
>
> raw_in
On 10/27/07, John <[EMAIL PROTECTED]> wrote:
>
> The problem is the infies are also being used in a shell scripted
> environment, they are frequently updated and cannot be changed.
>
> So ideadly I could just define a function which sourced the file, assuming
> the variable names passed in the *arg
The problem is the infies are also being used in a shell scripted
environment, they are frequently updated and cannot be changed.
So ideadly I could just define a function which sourced the file, assuming
the variable names passed in the *args list. So, yes, I know the names, they
just haven't bee
Win XP, Python 2.5.1
#!/usr/bin/env python
#coding=utf-8
n = 100 # 10 billion
print "type of 10 billion is", type(n)
n = 10 # 1 billion
print "type of 1 billion is", type(n)
raw_input("press enter to continue")
n = 100
print type(n)
while True:
On 10/27/07, John <[EMAIL PROTECTED]> wrote:
>
> Ok, so trying to convert it to a function:
>
> def source(ifile, *args):
> """ takes a file object and a list of variables as input.
> assumes, source file has variables in format:
> VAR[i]=variable """
>
> imp
Ok, so trying to convert it to a function:
def source(ifile, *args):
""" takes a file object and a list of variables as input.
assumes, source file has variables in format:
VAR[i]=variable """
import re
# Read the file
lines = fd.readlines()
On 10/27/07, Alan Gauld <[EMAIL PROTECTED]> wrote:
>
>
> "Dick Moores" <[EMAIL PROTECTED]> wrote
>
> > if type(n) == 'int' or type(n) == 'long':
> > do something
>
> don't use strings
>
> if type(n) == int
>
> Or just use an instance of the same type:
>
> if type(n) == type(42)
>
> Alan G.
>
> __
Thanks! This is helpful.. I like the RE approach as it's conceivable to
write a function...
On 10/27/07, Aditya Lal <[EMAIL PROTECTED]> wrote:
>
> You can source the file in python provided that you make it python
> friendly:-
>
> STN_id[1]='AAA' instead of STN_id[1]=AAA
> ...
>
>
> ---
>
You can source the file in python provided that you make it python
friendly:-
STN_id[1]='AAA' instead of STN_id[1]=AAA
...
---
import re
# Read the file
fd = open('sitelocations')
lines = fd.readlines()
fd.close()
# Make it python friendly: put all values in 'single quotes'
cmd = '\n'.joi
John wrote:
> I have a file sitelocations:
>
> STN_id[1]=AAA
> STNlat[1]=58.80
> STNlon[1]=17.40
> STNelv[1]=20
> STN_id[2]=BBB
> STNlat[2]=42.45
> STNlon[2]=25.58
> STNelv[2]=2925
>
> which in shell scripts I can simple 'source'. In Python I have to:
> sitesFile=file('sitelocat
I have a file sitelocations:
STN_id[1]=AAA
STNlat[1]=58.80
STNlon[1]=17.40
STNelv[1]=20
STN_id[2]=BBB
STNlat[2]=42.45
STNlon[2]=25.58
STNelv[2]=2925
which in shell scripts I can simple 'source'. In Python I have to:
sitesFile=file('sitelocations','r')
sites=sitesFile.readlines()
i
"Vinu Vikram" <[EMAIL PROTECTED]> wrote
> Could anybody try to tell me whether it is possible to run a
> function only
> for a particular time period. In my python script I call some third
> party
> function which some time won't give results. I would like to write
> the
> script in such a way
"Dick Moores" <[EMAIL PROTECTED]> wrote
> if type(n) == 'int' or type(n) == 'long':
> do something
don't use strings
if type(n) == int
Or just use an instance of the same type:
if type(n) == type(42)
Alan G.
___
Tutor maillist - Tutor@python.o
Hi All
Could anybody try to tell me whether it is possible to run a function only
for a particular time period. In my python script I call some third party
function which some time won't give results. I would like to write the
script in such a way that, it will wait for the result from this functio
At 04:34 AM 10/27/2007, Ricardo Aráoz wrote:
>Just take the quotes off :
>
>if type(n) == int or type(n) == long :
Thanks. I tried a lot of things, but not that one!
Dick
>HTH
Oh, yeah!
___
Tutor maillist - Tutor@python.org
http://mail.python.org/
Dick Moores wrote:
> I can't figure out how to test a variable n for its type.
>
> An example that is the wrong syntax, but shows what I want to do:
>
> if type(n) == 'int' or type(n) == 'long':
>do something
>
> elif type(n) == 'float':
>do something else
>
> elif type(n) == 'str':
>
I can't figure out how to test a variable n for its type.
An example that is the wrong syntax, but shows what I want to do:
if type(n) == 'int' or type(n) == 'long':
do something
elif type(n) == 'float':
do something else
elif type(n) == 'str':
do something different
What's the correc
At 01:13 AM 10/27/2007, Alan Gauld wrote:
>"Dick Moores" <[EMAIL PROTECTED]> wrote
>
> > OK, here's a short script, which runs fine on Windows. What do I add
> > to have it run on unix as well?
>
>Take a look at my Event Driven programming topic. It contains a
>simple key echo program using msvcrt
"Alex Ryu" <[EMAIL PROTECTED]> wrote
> I'm trying to use python to automatically download and process a
> (small)
> number of wikipedia articles. However, I keep getting a 403
> (Forbidden
> Error), when using urllib2:
FWIW I had a similar problem in trying to use Google to illustrate
the use
"Dick Moores" <[EMAIL PROTECTED]> wrote
> OK, here's a short script, which runs fine on Windows. What do I add
> to have it run on unix as well?
Take a look at my Event Driven programming topic. It contains a
simple key echo program using msvcrt and instructions for Linux
users to convert it to
48 matches
Mail list logo