Re: [Tutor] help with GUI

2006-06-22 Thread Kent Johnson
Christopher Spears wrote:
> My first problem is that the knob on the scrollbar
> doesn't move when I drag it.  I would like my GUI to
> by wider as well.  Finally, I need to figure out how
> to get the number selected from the scrollbar to the
> function that does the conversion.

Just guessing from a quick look at the pygtk docs...
Maybe you need to set_sensitive(True) on the VScale.
Call VScale.get_value() to get the value.

I'm not sure if there are any pyGTK experts on this list, if you don't 
get help here you might try the pyGTK list at
http://www.daa.com.au/mailman/listinfo/pygtk

Kent

___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


[Tutor] Question regarding commit/backout of a message using the pymqi module

2006-06-22 Thread Andrew Robert
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Hi everyone,

Could someone help explain what I am doing wrong in
this code block?

This code block is an excerpt from a larger file that receives
transmitted files via IBM WebSphere MQSeries an drops it to the local
file system.

Transmission of the file works as designed but it has a flaw.

If the file cannot be created for whatever reason, the transmitted
message is lost.

What I am trying to do is ensure that a file transmit is considered
successful only after the created file's checksum matches.

If not, the code should treat it as an error and roll back the message
to MQSeries without a commit.

The basis for this should be around the pymqi.QueueManager class which
is named mq in the block listed below.

On execution, I get the traceback of:

Traceback (most recent call last):
  File "M:\MQ\MQ\Scripts\receiver.py", line 269, in ?
receiver.run()
  File "M:\MQ\MQ\Scripts\receiver.py", line 109, in run
self.connect()
  File "M:\MQ\MQ\Scripts\receiver.py", line 118, in connect
self.qm.begin()
  File "c:\python24\lib\site-packages\pymqi.py", line 738, in begin
raise MQMIError(rv[0], rv[1])
pymqi.MQMIError: MQI Error. Comp: 1, Reason 2121: WARNING:
MQRC_NO_EXTERNAL_PARTICIPANTS



Do you have any idea why this might be occurring?


class Receiver(object):
def __init__(self,qm_name,queue_name):
self.qm_name = qm_name
self.queue_name = queue_name

# Will be set later
self.qm = None
self.message = None

def run(self):
self.connect()
self.get()

def connect(self):
"""
Connect to queue manager
"""
try:
self.qm = mq.QueueManager(options.qmanager.upper() )
self.qm.begin()
except mq.PYIFError, err:
mqevlog.event("error",err)
sys.exit(1)


def get(self):
"""
Get a message from queue.
"""
queue = mq.Queue(self.qm, self.queue_name)
pmo = mq.pmo(Options = CMQC.MQPMO_SYNCPOINT)
md = mq.md()



while True:
try:
var = queue.get(self.message, md, pmo )
except mq.MQMIError,e:
if e.reason != CMQC.MQRC_NO_MSG_AVAILABLE:
mqevlog.event("error",e)
sys.exit(1)
break
else:
buff = StringIO(var)
tree = ElementTree(file=buff)

# Extract required elements and assign to local 
variables
key   = "this should be a well-kept secret"
file_name = tree.find("dest").text
creation_time = tree.find("creation_time").text
contents  = tree.find("contents").text
check = tree.find("checksum").text


#Decode temp file
original = file_encoder.decode(contents)


# Drop file to disk
if  os.path.exists(file_name) is False:
open(file_name,"wb").write(original)
else:
mqevlog.event(sys.argv[0],"error","Output file 
path/name already
exists")
sys.exit(1)

# Get checksum of newly created file
sum=csums.getsum(file_name)

# Compare checksum of created file with value 
transmitted
if 
csums.checksum_compare(sys.argv[0],sum,check,file_name) == True:
queue.commit()
sys.exit(0)
else:
queue.backout()
mqevlog.event("error","CheckSums of
received/transmitted files do not match")
sys.exit(1)



Any help/insight you can provide on this would be greatly appreciated.


- --
Thank you,
Andrew Robert
Systems Architect
Information Technologies
MFS Investment Management
Phone:   617-954-5882

E-mail:  [EMAIL PROTECTED]
Linux User Number: #201204
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.2.1 (MingW32)
Comment: GnuPT 2.7.2

iD8DBQFEmoCtDvn/4H0LjDwRAonCAKCAiWPpO1UcXWMKIP8xPzCtzP6eLACeMWFO
qmHgdq/nI3gJ1v3jquDKnu8=
=Ga33
-END PGP SIGNATURE-
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


[Tutor] How to make the loop work?

2006-06-22 Thread Ivan Low
Hi, I'm new to python trying to figure how to make this work.

c=0;d=raw_input("input number limit: ")

while 1:
c = c + 1
if c == d: break
print c,


My idea is to able to input a number to limit the print out of this loop.
But this will not work. Where is the error?

Ivan
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] How to make the loop work?

2006-06-22 Thread Peter Jessop
It's basically correct but you need to convert the raw_input to integer.

c=0
d=int(raw_input("input number limit: "))
while 1:
  c = c + 1
  if c == d:
break
  print c
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


[Tutor] Python Word Unscrambler

2006-06-22 Thread Null Mr.Freeman


Python
Word Unscrambler:

OK,
this is the Python code I'm using to unscramble words but it unscrambles one
word at a time, can someone please help me out and tell me how can I improve my
code to make it decrypt several words at a time?
P.S: Another thing is that it prints the solution 4 or 5 times don't know why.

Sorry,
I'm very new to Python.
Please help if you can.
Thanks a ton!






CODE

import
string

def anagrams(s):
if s == "":
return [s]
else:
ans = []
for an in anagrams(s[1:]):
for pos
in range(len(an)+1):
ans.append(an[:pos]+s[0]+an[pos:])
return ans

def dictionary(wordlist):
dict = {}
infile = open(wordlist, "r")
for line in infile:
word =
line.split("\n")[0]
dict[word] = 1
infile.close()
return dict

def main():
anagram = raw_input("Please enter a words you need
to unscramble: ")
anaLst = anagrams(anagram)
diction = dictionary("wordlist.txt")
for ana in anaLst:
if diction.has_key(ana):
print
"The solution to the jumble is", ana

main()



 

___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] How to make the loop work?

2006-06-22 Thread Bob Gailer
Ivan Low wrote:
> Hi, I'm new to python trying to figure how to make this work.
>
> c=0;d=raw_input("input number limit: ")
>
> while 1:
> c = c + 1
> if c == d: break
> print c,
>
>
> My idea is to able to input a number to limit the print out of this loop.
> But this will not work. Where is the error?
>   
"Will not work" does not (in general) give us enough to go on. Please in 
the future tell us what the evidence of the problem is - e.g. unexpected 
output, exception, ... If it is an exception please include the 
traceback in your post.

-- 
Bob Gailer
510-978-4454

___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] How to make the loop work?

2006-06-22 Thread doug shawhan
Hi Bob,

You can use a while loop in this case, but range() might be a bit more appropriate!

c = 0
d = raw_input("Enter Number Limit: ")

for i in range(int(d)): #note, we make sure "d" is an integer!
    c = c + 1
    print cOn 6/22/06, Bob Gailer <[EMAIL PROTECTED]> wrote:
Ivan Low wrote:> Hi, I'm new to python trying to figure how to make this work.>> c=0;d=raw_input("input number limit: ")>> while 1:> c = c + 1> if c == d: break
> print c,>>> My idea is to able to input a number to limit the print out of this loop.> But this will not work. Where is the error?>"Will not work" does not (in general) give us enough to go on. Please in
the future tell us what the evidence of the problem is - e.g. unexpectedoutput, exception, ... If it is an exception please include thetraceback in your post.--Bob Gailer510-978-4454___
Tutor maillist  -  Tutor@python.orghttp://mail.python.org/mailman/listinfo/tutor
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


[Tutor] for loops over multiple lists of the same length

2006-06-22 Thread Emily Fortuna
I feel like there should be a better way to do this process:
Can you please help?
(This is trivial example code I created off the top of my head, but the 
same concept that I am trying to do elsewhere.)

class Person(object):
def __init__(self, first_name, age, fav_color):
self.first_name = first_name
self.age = age
self.fav_color = fav_color

first_names = ['emily', 'john', 'jeremy', 'juanita']
ages = [6, 34, 1, 19]
colors = ['blue', 'orange', 'green', 'yellow']

ageIter = ages.iter()
colorIter = colors.iter()
people = [Person(name, ageIter.next(), colorIter.next()) for name in 
first_names]

print people

any suggestions, please?
Emily

___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] for loops over multiple lists of the same length

2006-06-22 Thread Kent Johnson
Emily Fortuna wrote:
> I feel like there should be a better way to do this process:
> Can you please help?
> (This is trivial example code I created off the top of my head, but the 
> same concept that I am trying to do elsewhere.)
> 
> class Person(object):
>   def __init__(self, first_name, age, fav_color):
>   self.first_name = first_name
>   self.age = age
>   self.fav_color = fav_color
> 
> first_names = ['emily', 'john', 'jeremy', 'juanita']
> ages = [6, 34, 1, 19]
> colors = ['blue', 'orange', 'green', 'yellow']
> 
> ageIter = ages.iter()
> colorIter = colors.iter()
> people = [Person(name, ageIter.next(), colorIter.next()) for name in 
> first_names]
>   
> print people
> 
> any suggestions, please?

The builtin function zip() does this:
people = [Person(name, age, color) for name, age color in
zip(first_names, ages, colors)]

Kent

___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] How to make the loop work?

2006-06-22 Thread Ivan Low
Bob Gailer wrote:
> Ivan Low wrote:
>> Hi, I'm new to python trying to figure how to make this work.
>>
>> c=0;d=raw_input("input number limit: ")
>>
>> while 1:
>> c = c + 1
>> if c == d: break
>> print c,
>>
>>
>> My idea is to able to input a number to limit the print out of this 
>> loop.
>> But this will not work. Where is the error?
>>   
> "Will not work" does not (in general) give us enough to go on. Please 
> in the future tell us what the evidence of the problem is - e.g. 
> unexpected output, exception, ... If it is an exception please include 
> the traceback in your post.
>
Hi, thanks for helping.
After the reply from Peter by suggesting that I convert the raw_input to 
int, it works.
Sorry that I didn't supply enough information in my post.
However I'm curious about the result of my initial code after I enter a 
number which
prompted by the raw_input it just keep printing numbers without break.
Why is it acting like that?

___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


[Tutor] [Fwd: Re: for loops over multiple lists of the same length]

2006-06-22 Thread Orri Ganel

Oops, forgot to reply to the list; sorry everyone.

--
Email: singingxduck AT gmail DOT com
AIM: singingxduck
Programming Python for the fun of it.

--- Begin Message ---

Emily Fortuna wrote:


Thanks, I knew there had to be a really simple way to do it.
Emily


Orri Ganel wrote:


Emily Fortuna wrote:


I feel like there should be a better way to do this process:
Can you please help?
(This is trivial example code I created off the top of my head, but 
the same concept that I am trying to do elsewhere.)


class Person(object):
def __init__(self, first_name, age, fav_color):
self.first_name = first_name
self.age = age
self.fav_color = fav_color

first_names = ['emily', 'john', 'jeremy', 'juanita']
ages = [6, 34, 1, 19]
colors = ['blue', 'orange', 'green', 'yellow']

ageIter = ages.iter()
colorIter = colors.iter()
people = [Person(name, ageIter.next(), colorIter.next()) for name in 
first_names]

print people

any suggestions, please?
Emily

___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

 

 >>> people = [Person(first_names[i], ages[i], colors[i]) for i in 
range(len(ages))]


Usually, you want to stay away from for i in range(len(foo)) because 
it's easier to just use for elem in foo or  for i, elem in 
enumerate(foo), but since you need the indeces alone, this seems like 
an appropriate place to use it.  Alternatively, you could zip them 
together:


 >>> people = [Person(*zipped) for zipped in zip(first_names, ages, 
colors)]


By zipping the lists together, you end up with a list of three-tuples:

 >>> zip(first_names, ages, colors)
[('emily', 6, 'blue'), ('john', 34, 'orange'), ('jeremy', 1, 
'green'), ('juanita', 19, 'yellow')]


And by putting an asterisk in front of zipped, you're passing each 
element in the three-tuple one at a time instead of the whole shebang 
at once, so that you end up with three arguments, not one.



HTH,
Orri




Actually, Kent had a very similar, and much more readable suggestion (if 
you didn't see it, it's the following):


>>> people = [Person(first_name, age, color) for first_name, age, color 
in zip(first_names, ages, colors)]


I guess it depends on how legible you feel your code needs to be; for 
some, my suggestion would be more than enough.


--
Email: singingxduck AT gmail DOT com
AIM: singingxduck
Programming Python for the fun of it.


--- End Message ---
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] How to make the loop work?

2006-06-22 Thread Orri Ganel
Ivan Low wrote:

>Bob Gailer wrote:
>  
>
>>Ivan Low wrote:
>>
>>
>>>Hi, I'm new to python trying to figure how to make this work.
>>>
>>>c=0;d=raw_input("input number limit: ")
>>>
>>>while 1:
>>>c = c + 1
>>>if c == d: break
>>>print c,
>>>
>>>
>>>My idea is to able to input a number to limit the print out of this 
>>>loop.
>>>But this will not work. Where is the error?
>>>  
>>>  
>>>
>>"Will not work" does not (in general) give us enough to go on. Please 
>>in the future tell us what the evidence of the problem is - e.g. 
>>unexpected output, exception, ... If it is an exception please include 
>>the traceback in your post.
>>
>>
>>
>Hi, thanks for helping.
>After the reply from Peter by suggesting that I convert the raw_input to 
>int, it works.
>Sorry that I didn't supply enough information in my post.
>However I'm curious about the result of my initial code after I enter a 
>number which
>prompted by the raw_input it just keep printing numbers without break.
>Why is it acting like that?
>
>___
>Tutor maillist  -  Tutor@python.org
>http://mail.python.org/mailman/listinfo/tutor
>
>  
>
Well, since you didn't convert d to an integer, and a string can never 
equal an integer, c never equals d, and therefore you get an infinite 
loop, which continues to print c.

-- 
Email: singingxduck AT gmail DOT com
AIM: singingxduck
Programming Python for the fun of it.

___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


[Tutor] Escape sequences

2006-06-22 Thread David Heiser

I have code that assigns escape sequences to variables like
"self.resetString = '\03'". As long as they are hard coded in,
everything works fine.

But I want to read the variable from a text/config file so my users can
override the defaults. In the file are a list of "parameter = value"
pairs like "resetString = \03". As the file is parsed, each pair is
stored in a dictionary; "parmeterDictionary[parameter] = value".

Then in the code, the value is assigned to the variable with a statement
like "self.resetString = parmeterDictionary['resetString']".

Simple ASCII strings work fine, but the escape sequences don't work and
the code fails. "print self.resetString" returns "\\03", instead of a
nonprintable character.

Any ideas?

David Heiser
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Escape sequences

2006-06-22 Thread Kent Johnson
David Heiser wrote:
> I have code that assigns escape sequences to variables like
> "self.resetString = '\03'". As long as they are hard coded in,
> everything works fine.
> 
> But I want to read the variable from a text/config file so my users can
> override the defaults. In the file are a list of "parameter = value"
> pairs like "resetString = \03". As the file is parsed, each pair is
> stored in a dictionary; "parmeterDictionary[parameter] = value".
> 
> Then in the code, the value is assigned to the variable with a statement
> like "self.resetString = parmeterDictionary['resetString']".
> 
> Simple ASCII strings work fine, but the escape sequences don't work and
> the code fails. "print self.resetString" returns "\\03", instead of a
> nonprintable character.

Use the 'string_escape' codec to decode the escaped strings:

In [1]: s= '\\03'

In [2]: s
Out[2]: '\\03'

In [3]: len(s)
Out[3]: 3

In [4]: s.decode('string_escape')
Out[4]: '\x03'

In [5]: len(_)
Out[5]: 1

Kent

___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] for loops over multiple lists of the same length

2006-06-22 Thread Shantanoo Mahajan
+++ Emily Fortuna [22-06-06 13:22 -0400]:
| I feel like there should be a better way to do this process:
| Can you please help?
| (This is trivial example code I created off the top of my head, but the 
| same concept that I am trying to do elsewhere.)
| 
| class Person(object):
|   def __init__(self, first_name, age, fav_color):
|   self.first_name = first_name
|   self.age = age
|   self.fav_color = fav_color
| 
| first_names = ['emily', 'john', 'jeremy', 'juanita']
| ages = [6, 34, 1, 19]
| colors = ['blue', 'orange', 'green', 'yellow']
| 
| ageIter = ages.iter()
| colorIter = colors.iter()
| people = [Person(name, ageIter.next(), colorIter.next()) for name in 
| first_names]
|   
| print people
| 
| any suggestions, please?
| Emily

data = 
[['emily',6,'blue'],['jhon',34,'orange'],['jeremy',1,'green'],['junita',19,'yellow']]
people = [Person(name,age,color) for name,age,color in data]


Regards,
Shantanoo
-- 
Eliminate guilt. Don't fiddle expenses, taxes or benefits, and don't
cheat colleagues.
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] How to make the loop work?

2006-06-22 Thread Bob Gailer
Ivan Low wrote:
> Bob Gailer wrote:
>   
>> Ivan Low wrote:
>> 
>>> Hi, I'm new to python trying to figure how to make this work.
>>>
>>> c=0;d=raw_input("input number limit: ")
>>>
>>> while 1:
>>> c = c + 1
>>> if c == d: break
>>> print c,
>>>
>>>
>>> My idea is to able to input a number to limit the print out of this 
>>> loop.
>>> But this will not work. Where is the error?
>>>   
>>>   
>> "Will not work" does not (in general) give us enough to go on. Please 
>> in the future tell us what the evidence of the problem is - e.g. 
>> unexpected output, exception, ... If it is an exception please include 
>> the traceback in your post.
>>
>> 
> Hi, thanks for helping.
> After the reply from Peter by suggesting that I convert the raw_input to 
> int, it works.
> Sorry that I didn't supply enough information in my post.
> However I'm curious about the result of my initial code after I enter a 
> number which
> prompted by the raw_input it just keep printing numbers without break.
> Why is it acting like that?
>   
Python will compare any two objects. If their types are not compatible 
for comparison the result is False. Your program was comparing a 
character string to a numeric. Their types are not "compatible". Hence 
always False.
> ___
> Tutor maillist  -  Tutor@python.org
> http://mail.python.org/mailman/listinfo/tutor
>
>   


-- 
Bob Gailer
510-978-4454

___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Escape sequences

2006-06-22 Thread David Heiser

That worked just dandy. Thanks.


-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On
Behalf Of Kent Johnson
Sent: Thursday, June 22, 2006 1:03 PM
Cc: tutor@python.org
Subject: Re: [Tutor] Escape sequences


David Heiser wrote:
> I have code that assigns escape sequences to variables like 
> "self.resetString = '\03'". As long as they are hard coded in, 
> everything works fine.
> 
> But I want to read the variable from a text/config file so my users 
> can override the defaults. In the file are a list of "parameter = 
> value" pairs like "resetString = \03". As the file is parsed, each 
> pair is stored in a dictionary; "parmeterDictionary[parameter] = 
> value".
> 
> Then in the code, the value is assigned to the variable with a 
> statement like "self.resetString = parmeterDictionary['resetString']".
> 
> Simple ASCII strings work fine, but the escape sequences don't work 
> and the code fails. "print self.resetString" returns "\\03", instead 
> of a nonprintable character.

Use the 'string_escape' codec to decode the escaped strings:

In [1]: s= '\\03'

In [2]: s
Out[2]: '\\03'

In [3]: len(s)
Out[3]: 3

In [4]: s.decode('string_escape')
Out[4]: '\x03'

In [5]: len(_)
Out[5]: 1

Kent

___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


[Tutor] A few more notes on Python interfaces

2006-06-22 Thread Dave Kuhlman
Several weeks ago, there was a discussion on this list about the
use of interfaces in Python.  That motivated me to write up some
notes on Python interfaces, in part to force myself to learn a bit
more about it.  Needless to say, my notes benefited much from the
comments on this list.  You can find these notes here:

http://www.rexx.com/~dkuhlman/python_comments.html#interfaces

I'll welcome any comments.

And, thanks for the interesting and helpful discussion on
interfaces, and other topics, on this list.

Dave

-- 
Dave Kuhlman
http://www.rexx.com/~dkuhlman
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


[Tutor] Is this correct syntax for what I want?

2006-06-22 Thread Nathan Pinno



I want to be able to add and subtract from a number 
in a tuple in a list. Is this the correct syntax?
 
letterlist[x] = letterlist[x] + amount # for 
addition
 
letterlist[x] = letterlist[x] - amount # for 
subtraction
 
If this is not correct, what is the correct 
syntax?
 
Thanks,
Nathan Pinno
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


[Tutor] MySQLdb: cant get '... where field in %s' to work for string sequences

2006-06-22 Thread Justin Ezequiel
how can I get 'select ... from ... where field in %s' to work for
sequences of strings?
sequences of integers works just fine

import MySQLdb

DBCRED = {'host': 'localhost', 'user': 'userjustin',
  'passwd': 'passwdjustin', 'db': 'dbjustin'}

ARTICLES = ('XXX9', 'ABZ2')
PIDS = (29379, 29380)

FIXEDARTICLENAME = """SELECT * FROM tblForTransfer2Prodsite
WHERE articleName IN ('XXX9', 'ABZ2')"""
TESTARTICLENAME = """SELECT * FROM tblForTransfer2Prodsite
WHERE articleName IN %r""" % (ARTICLES,)
SQLARTICLENAME = """SELECT * FROM tblForTransfer2Prodsite
WHERE articleName IN %s"""

FIXEDPID = """SELECT * FROM tblForTransfer2Prodsite
WHERE pid IN (29379, 29380)"""
TESTPID = """SELECT * FROM tblForTransfer2Prodsite
WHERE pid IN %r""" % (PIDS,)
SQLPID = """SELECT * FROM tblForTransfer2Prodsite
WHERE pid IN %s"""

if __name__ == '__main__':
conn = MySQLdb.connect(**DBCRED)
try:
cur = conn.cursor()
print FIXEDARTICLENAME
print TESTARTICLENAME
print cur.execute(FIXEDARTICLENAME),
print cur.execute(TESTARTICLENAME),
# cannot get this to work
print cur.execute(SQLARTICLENAME, (ARTICLES,))
print
print FIXEDPID
print TESTPID
print cur.execute(FIXEDPID),
print cur.execute(TESTPID),
# but this does
print cur.execute(SQLPID, (PIDS,))
print
finally: conn.close()
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


[Tutor] [ANN] RUR-PLE version 0.9.9

2006-06-22 Thread Andre Roberge
Roberge's Used Robot: a Python Learning Environment

Version 0.9.9 of RUR-PLE has been released.  It can be found at:
https://sourceforge.net/project/showfiles.php?group_id=125834

RUR-PLE should work properly on all major platforms (Mac, Linux and
Windows) in 3 different languages (English, French, Spanish).
Feedback would be appreciated to confirm this prior to release of
version 1.0.

--
Learning to program computer should be fun, for adults and children
alike. RUR-PLE is an environment designed to help you learn computer
programming using Python. RUR-PLE is a wxPython-based app.

RUR-PLE contains four main elements:
1. Lessons viewable within an incorporated browser. Version 0.9.9
includes over 40 lessons introducing Python.   A few more will be
written for the 1.0 release.
2. A "robot world" with a robot that can accomplish tasks through Python
programs.
3. A built-in interpreter which can be used to play with Python.
4. A built-in file editor which can be used for futher Python explorations.

This version includes a triilingual (English, French and Spanish)
interface.  Translations to other languages are welcome.

Only English lessons are included.

André
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Is this correct syntax for what I want?

2006-06-22 Thread Terry Carroll
On Thu, 22 Jun 2006, Nathan Pinno wrote:

> I want to be able to add and subtract from a number in a tuple in a
> list. Is this the correct syntax?
> 
> letterlist[x] = letterlist[x] + amount # for addition
> 
> letterlist[x] = letterlist[x] - amount # for subtraction

Try it.

___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


[Tutor] what does the warning indicate?

2006-06-22 Thread devayani barve
Hi!!
I'm new to python and just trying to play around,
when I run my program in the interactive shell before executing the program it shows the following warning :
 
 Warning: HOME environment variable points to H: but the path does not exist. RESTART >>> 
 
or sometimes it just gets stuck.
What does this mean?
 
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] what does the warning indicate?

2006-06-22 Thread Carlos Daniel Ruvalcaba Valenzuela
Most probably you are using Python on Windows, on Unix-like system
there is a "home" for each user where the user files reside, normally
HOME on windows must point to something like c:\Documents and
Settings\Username, are you using Python on Windows 98?

Otherwise it may be a problem with the enviroment variable (Home),
pointing to drive H (H:), while it dosen't exist in your system.

Anyways, that's my 2 cents :)


On 6/22/06, devayani barve <[EMAIL PROTECTED]> wrote:
>
> Hi!!
> I'm new to python and just trying to play around,
> when I run my program in the interactive shell before executing the program
> it shows the following warning :
>
>  Warning: HOME environment variable points to
>  H:
>  but the path does not exist.
>  RESTART
> 
> >>>
>
> or sometimes it just gets stuck.
> What does this mean?
>
> ___
> Tutor maillist  -  Tutor@python.org
> http://mail.python.org/mailman/listinfo/tutor
>
>
>
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor