[Tutor] Error terminal

2019-08-07 Thread Richard Rizk
Hello I wanted to send you this email to ask if you would have someone that can solve the problem I'm having with python. I'm having issues with terminal on mac, is there someone that can help with this? Best regards, Richard ___ Tuto

Re: [Tutor] Name for this type of class?

2019-08-03 Thread Richard Damon
lections of files, lines > bytes. (i.e. arrays or tuples...) > "___count" implies an integer. > If the latter, I'd use "n_files", "n_lines" ... (possibly without the > underscores if you find typing them a bother.) > Comments? I agree, plura

Re: [Tutor] Output reason

2019-07-12 Thread Richard Damon
If I remember how that works right, there is a single empty list that is created and used for all the calls that use the default argument, and then your function modifies that empty list so it is no longer empty, and that modified list is used on future calls. (Not good to use a mutable as a def

Re: [Tutor] Make a linked list subscriptable?

2019-07-12 Thread Richard Damon
plement __setitem__, __delitem__), and check if the argument is a slice to handle slices. -- Richard Damon ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor

[Tutor] Setting Command Line Arguments in IDLE

2019-05-26 Thread Richard Damon
directory the script is in (it will be typically run using the PATH, so not the same directory as the script)? If not, is there an easy way to detect that I am running in IDLE so I can fake the command line arguments when testing? -- Richard Damon ___ Tutor

Re: [Tutor] [SPAM?] Re: Case Insensitive Globing

2019-05-18 Thread Richard Damon
On 5/18/19 6:52 AM, Alan Gauld via Tutor wrote: > On 18/05/2019 03:14, Richard Damon wrote: > >> The same directory, running the same program under Mac OS X, which also >> is a case insensitive file system, > That is your mistake. Darwin, the core of the MacOS X system >

[Tutor] Case Insensitive Globing

2019-05-18 Thread Richard Damon
something like:   for file in glob.glob(pattern): processfile(file) -- Richard Damon ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor

[Tutor] TESTING

2018-11-01 Thread richard mwenya via Tutor
Hello. Everyone is quiet or is it my email thats not working? ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] program code for Python Programming for the Absolute Beginner, 3rd ed.?

2017-07-02 Thread Richard Grose
/Absolute Book/py3e_source at master · CWade3051/Py · GitHub <https://github.com/CWade3051/Py/tree/master/Absolute%20Book/py3e_source> Richard G ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor

[Tutor] Help with scoping

2017-03-23 Thread Richard Mcewan
end of the while loop instead of duplicating at the end of if conditions. Appreciate the help. Will come back to the list with new topics in the future no doubt and look forward to mailings. Thanks Richard Code from 2.7 Python running on Pythonista iOS app. # coding: utf-8 import rand

[Tutor] Help with function scoping

2017-03-23 Thread Richard Mcewan
Hi Thanks Mats, Joel and Alan for helpful advice. This code (below) behaves as I wanted now. And think I see where I was going wrong with functions. Thank you very much. Richard Ps I'll reflect on appropriate variable names also. # coding: utf-8 import random #guess number

[Tutor] Help with function scoping

2017-03-22 Thread Richard Mcewan
unction elsewhere. Advice welcome. Richard Using Pythonista App on iOS with Python 2.7 on iPhone 5s # coding: utf-8 import random #guess number game #computer generates random number def generateNumber(): computerGuess = int(random.randrange(0,101)) return computerGuess #get user def

Re: [Tutor] formatting xml (again)

2016-12-28 Thread richard kappler
\x03 it goes to a new line and continues to output? On Tue, Dec 27, 2016 at 7:46 PM, David Rock wrote: > * Alan Gauld via Tutor [2016-12-28 00:40]: > > On 27/12/16 19:44, richard kappler wrote: > > > Using python 2.7 - I have a large log file we recorded of streamed xml > dat

Re: [Tutor] formatting xml (again)

2016-12-27 Thread richard kappler
e fact that 'events' span multiple lines is challenging me. On Tue, Dec 27, 2016 at 3:55 PM, David Rock wrote: > * richard kappler [2016-12-27 15:39]: > > I was actually working somewhat in that direction while I waited. I had > in > > mind to use something along the l

Re: [Tutor] formatting xml (again)

2016-12-27 Thread richard kappler
f2.write(line1) line1 = "" but that didn't work. It neither broke each line on etx (multiple events with stx and etx on one line) nor did it concatenate the multi-line events. On Tue, Dec 27, 2016 at 3:25 PM, David Rock wrote: > * richard kappler [2016-1

[Tutor] formatting xml (again)

2016-12-27 Thread richard kappler
ad around how to do it. Or to put, and do, it another way, how do I read each line from the original file, but write it to another file so that everything from stx to etx, including stx and etx, are on one line in the file? regards Richard ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor

[Tutor] please help me modify this code so that I can utilize raw_input

2016-10-04 Thread Richard Koeman
I would like to modify this code so that instead of me calling the function with the list as shown [1,2,3,4], the user inputs the list with raw_input. Thanks in advance """Define a function sum() and a function multiply() that sums and multiplies (respectively) all the numbers in a list of numbe

[Tutor] python coding problem

2016-09-26 Thread Richard Koeman
This is my first time using this so I hope it works. I am trying to find out why this code doesnt work. Its simple. I want to find out which number is bigger. I hope you can help and that I am using this python feature properly. Thanks. The function prints the first two print statements then noth

[Tutor] Buffer code review

2016-02-12 Thread richard kappler
or('tag match fail line ' + str(i)) buf = '' # update log.txt file size eof = neweof logging.info('eof set to neweof, sleeping 2, eof =' + str(eof)) time.sleep(2) elif neweof < eof: # this resets eof at night when old

Re: [Tutor] declare a variable inside a class

2016-02-12 Thread richard kappler
On Fri, Feb 12, 2016 at 2:23 AM, Ian Winstanley wrote: > To refer to a class variable you need to put the class name first for > example MyClass.xslt > That indeed did the trick, thanks Ian. regards, Richard -- *Java is like Alzheimers; it starts slow and eventually, it takes aw

Re: [Tutor] declare a variable inside a class

2016-02-11 Thread richard kappler
says the global variable xslt is not defined. Does that help? regards, Richard On Thu, Feb 11, 2016 at 3:43 PM, Martin A. Brown wrote: > > Hi there again Richard, > > [snipped a bit of stuff] > > >The method that actually formats the messages opens the xslt file, > >

[Tutor] declare a variable inside a class

2016-02-11 Thread richard kappler
, it through an exception that the variable xslt wasn't defined. This is my first not-a-toy try at OOP, I could use a clue. regards, Richard -- *Java is like Alzheimers; it starts slow and eventually, it takes away all of your memory.* ___ Tutor ma

Re: [Tutor] script follows a file into zip?

2016-02-05 Thread richard kappler
Ah, I see, makes perfect sense now that it's right under my nose. Thanks Peter! regards, Richard On Fri, Feb 5, 2016 at 12:04 PM, Peter Otten <__pete...@web.de> wrote: > richard kappler wrote: > > > I have a script that checks a file and if there are new additions to t

[Tutor] script follows a file into zip?

2016-02-05 Thread richard kappler
: while True: and so on 2. Get rid of the elif neweof == eof statement and just make it else: pass to send it back to the beginning of the loop (doesn't make sense to me, but wanted to throw it out there). regards, Richard -- No matter where you go, there you are. - Buckaroo

Re: [Tutor] reading an input stream

2016-01-07 Thread richard kappler
ith. That will not change in the forseeable future. Doing other homework right now, but will more closely review this and the other posts that have come in since I left work later tonight or first thing in the morning. regards, Richard ___ Tutor mail

Re: [Tutor] Syntax error

2016-01-07 Thread richard kappler
Hi Sarah! instead of 'python hello.py', try >>>import hello.py using python hello.py works from the Linux command line (presumably Windows as well) and it starts python then runs the hello.py script. From within the python interpreter, you import the file and it executes. H

[Tutor] multipart socket streaming problem: threading??

2016-01-05 Thread richard kappler
ut have read some of the documentation and it seems pretty straight forward, if I have questions I will of course ask, but the preliminary question is: Do I in fact need to do this? Is threading the way to go or is just running all the data through the same 'pi

[Tutor] multipart socket streaming problem: the delimiters

2016-01-05 Thread richard kappler
cking and non-blocking sockets, not block format messages. Is there a library or tutorial out there anyone knows of that might help with this? regards, Richard ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor

[Tutor] multipart socket streaming problem: reading the stream

2016-01-05 Thread richard kappler
ine 620, in lxml.etree._raiseParseError (src/lxml/lxml.etree.c:91722) IOError: Error reading file and then the error message printed out the entire file to screen, which I won't here for brevity. I was, however, able to receive the the stream as above,

[Tutor] multipart socket streaming problem: the socket

2016-01-05 Thread richard kappler
that many machines? - Buffer size is set at 8192, yet the messages may be much larger, can I safely increase that? Should I? - I'm presuming that the OS handles assembly of a message that comes in more than one packet using the TCP/IP protocols, but is that true? regards, Richard ___

Re: [Tutor] reading an input stream

2015-12-29 Thread richard kappler
anny, best explanation of generators I've heard, well done and thank you. regards, Richard On Thu, Dec 24, 2015 at 4:54 PM, Danny Yoo wrote: > > I think what I need to do would be analogous to (pardon if I'm using the > > wrong terminology, at this poing in the discussion I a

[Tutor] reading an input stream

2015-12-24 Thread richard kappler
the parser while accepting the next STX + message fragment into the buffer, or something analogous. Any guidance here? And Merry Christmas / Happy Holidays / Festive whatever you celebrate!!! regards, Richard -- "I want to makes shoes!" -> elf fleeing the fire engulfed Keebler Tree

[Tutor] Modules and variable usage in functions from other files

2015-12-24 Thread Richard Bekenstein
Dear All, I have a main .py script which contains code that occasionally calls some functions. This script calls in these defined functions from other .py files in the same directory as the main .py. However, even after importing the functions from the different .py files, I get err

[Tutor] responding to command line

2015-11-24 Thread richard kappler
I need to write a script that runs ssh-copy-id to over 500 clients from one master (setting up keys to use ansible). I understand how to get my script to read each IP address in a list, use it as input and then move on to the next, but not sure how to handle the password feed, particularly as ther

[Tutor] parsing xml as lines

2015-11-04 Thread richard kappler
I have an xml file that get's written to as events occur. Each event writes a new 'line' of xml to the file, in a specific format, eg: sometthing like this: http://www.w3.org/2001/XMLSchema-instance"; xsi:noNamespaceSchemaLocation="Logging.xsd" version="1.0">somestuff and each 'line' has that sam

Re: [Tutor] socket communications and threading

2015-10-27 Thread richard kappler
to re-read the tutorials and examples, thank you. regards, Richard On Tue, Oct 27, 2015 at 1:44 PM, Alan Gauld wrote: > On 27/10/15 14:52, richard kappler wrote: > > In our test environment we have simulated this by building three vm's. VM1 >> has a python script that sends raw da

[Tutor] socket communications and threading

2015-10-27 Thread richard kappler
, but the main point of the entire email is question 1, threading. regards, Richard ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] general exception questions

2015-10-05 Thread richard kappler
F exiting the program with a trace error. > > errors = [] > for line in file: >try: > process(line) >except SomeError as e: > errors.append((line,e)) > > if errors: >for e in errors: > display_error(e) > > where display_error() is an exerc

[Tutor] general exception questions

2015-10-05 Thread richard kappler
do something except: pass I know (so many of you have told me :-) that using pass is a bad idea, but how else do you skip the current line if the 'try' can't be done, and go on to the next line exiting the program with a trace error? regards, Richard __

Re: [Tutor] stx, etx (\x02, \x03)

2015-09-28 Thread richard kappler
> > Hi Richard, > > Just to check: what operating system are you running your program in? > Also, what version of Python? > Hi Danny, using Linux and Python 2.7 > > > > ## > with open('input/test.xml', 'rU') as f1

Re: [Tutor] stx, etx (\x02, \x03)

2015-09-22 Thread richard kappler
xt file: line one line two line three line four and ran the above code (changing the file names of course) and it came out perfect. Each line begins with the \x02 hex and ends with the \x03 hex. regards, Richard ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] stx, etx (\x02, \x03)

2015-09-22 Thread richard kappler
f2.write(s) mod1.xml has the \x02 hex at the beginning of line 1, then line 2 and all further lines begin with the \x03 hex then the \x02 hex and then the line. regards, Richard ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] stx, etx (\x02, \x03)

2015-09-22 Thread richard kappler
Thanks for the reply Mark, tried that, same result. On Tue, Sep 22, 2015 at 8:58 AM, Mark Lawrence wrote: > On 22/09/2015 13:37, richard kappler wrote: > >> I have a file with several lines. I need to prepend each line with \x02 >> and >> append each line with \x03 fo

[Tutor] stx, etx (\x02, \x03)

2015-09-22 Thread richard kappler
e. I have tried: #!/usr/bin/env python with open('input/test.xml', 'r') as f1: with open('mod1.xml', 'a') as f2: for line in f1: s = ('\x02' + line + '\x03') f2.write(s) as well as the same script b

Re: [Tutor] changing a variable with raw_input

2015-09-16 Thread richard kappler
Nevermind, figured it out. it needed to be delay = 0 and delay = 0.5, not == regards, Richard the virus ridden On Wed, Sep 16, 2015 at 1:03 PM, richard kappler wrote: > Missing something obvious here, but down with the flu so I'm foggy and > just can't see it. I need to set a

[Tutor] changing a variable with raw_input

2015-09-16 Thread richard kappler
nt 'delay = ' + str(delay) If I enter 1 or 2, I get delay = 7, if I enter 3, I get delay = real time. HUH??? regards, Richard -- All internal models of the world are approximate. ~ Sebastian Thrun ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] ftp socket.error

2015-09-14 Thread richard kappler
Thanks for all the assistance, turned out it was a problem with the iptables not having an accept for eth1. Onward and upward! regards, Richard On Sat, Sep 12, 2015 at 12:24 PM, Martin A. Brown wrote: > > Hello and good morning > > I may be mistaken, but it looks like you are tr

[Tutor] Type Error

2015-09-14 Thread richard kappler
Still working on my data feed script, if you'll recall from previous emails, it reads incoming data and creates a name for image files based on the incoming data in a test environment. below is a snippet of that code that copies the next image in the pool renaming it as it copies, sends to another

Re: [Tutor] ftp socket.error

2015-09-11 Thread richard kappler
I try to send a file it goes bollocks up. Still need ideas. regards, Richard On Fri, Sep 11, 2015 at 12:17 PM, richard kappler wrote: > Figured it out. On the receiving machine I had to > > # modprobe ip_conntrack_ftp > > > On Fri, Sep 11, 2015 at 12:00 PM, richard kappler &g

Re: [Tutor] ftp socket.error

2015-09-11 Thread richard kappler
Figured it out. On the receiving machine I had to # modprobe ip_conntrack_ftp On Fri, Sep 11, 2015 at 12:00 PM, richard kappler wrote: > I can connect via ftp, but when I try to send a file, I get a no route to > host error, I don't understand. > > code: > > >&

[Tutor] ftp socket.error

2015-09-11 Thread richard kappler
/lib64/python2.6/ftplib.py", line 360, in transfercmd return self.ntransfercmd(cmd, rest)[0] File "/usr/lib64/python2.6/ftplib.py", line 326, in ntransfercmd conn = socket.create_connection((host, port), self.timeout) File "

[Tutor] indent error on if/elif/else

2015-09-10 Thread richard kappler
27;s the Traceback: File "dataFeedTest.py", line 44 else: ^ IndentationError: expected an indented block Not a clue why it's doing this. Any help? regards, Richard -- All internal models of the world are approximate. ~ Sebastian Thrun _

Re: [Tutor] A further question about opening and closing files

2015-09-09 Thread richard kappler
Thanks, tried them both, both work great on Linux. Now I understand better. regards, Richard On Wed, Sep 9, 2015 at 11:28 AM, Laura Creighton wrote: > >I did a little experiment: > > > >>>> f1 = open("output/test.log", 'a') > >>>&

Re: [Tutor] iterating through a directory

2015-09-09 Thread richard kappler
though, in other words, for each iteration in the loop, I want it to fetch, rename and send/save the next image in line. Hope that brings better understanding. Thanks for the tip! regards, Richard On Wed, Sep 9, 2015 at 9:46 AM, Albert-Jan Roskam wrote: > > Date: Wed, 9 Sep 2015 09:32:34

[Tutor] A further question about opening and closing files

2015-09-09 Thread richard kappler
option to reload the file. This didn't happen until I closed the file. So I'm presuming all the writes sat in a buffer in memory until the file was closed, at which time they were written to the file. Is that actually how it happens, and if so does that not al

Re: [Tutor] More Pythonic?

2015-09-09 Thread richard kappler
e other than to say it's not reading from stdin, but from a log file to simulate stdin in a test environment. regards, Richard On Wed, Sep 9, 2015 at 9:37 AM, Peter Otten <__pete...@web.de> wrote: > richard kappler wrote: > > > Would either or both of these wo

[Tutor] Fwd: Fwd: find second occurance of string in line

2015-09-09 Thread richard kappler
e the output of the two scripts. If it's the same now there's no harm switching to lxml, and you are making future failures less likely. I'll take a look at it, thanks. regards, Richard ___ Tutor maillist - Tutor@python.org To uns

[Tutor] iterating through a directory

2015-09-09 Thread richard kappler
Yes, many questions today. I'm working on a data feed script that feeds 'events' into our test environment. In production, we monitor a camera that captures an image as product passes by, gathers information such as barcodes and package ID from the image, and then sends out the data as a line of xm

[Tutor] More Pythonic?

2015-09-09 Thread richard kappler
writefile once per iteration, and the do nothing in the except seems just wrong to me. Is my thinking on target here? regards, Richard -- All internal models of the world are approximate. ~ Sebastian Thrun ___ Tutor maillist - Tutor@python.o

[Tutor] Fwd: find second occurance of string in line

2015-09-08 Thread richard kappler
what I was looking for, off to test now. Thanks Alan! regards, Richard ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor

[Tutor] find second occurance of string in line

2015-09-08 Thread richard kappler
I need to find the index of the second occurance of a string in an xml file for parsing. I understand re well enough to do what I want to do on the first instance, but despite many Google searches have yet to find something to get the index of the second instance, because split won't really work on

[Tutor] iteration help

2015-08-20 Thread richard kappler
Running python 2.7 on Linux While for and if loops always seem to give me trouble. They seem obvious but I often don't get the result I expect and I struggle to figure out why. Appended below is a partial script. Ultimately, this script will read a log, parse out two times from each line of the lo

Re: [Tutor] line iteration in a file

2015-06-05 Thread richard kappler
SOLVED: Sometimes one just has to be an idiot. One must remember that computers count from zero, not from one. Changes my list indexes to reflect that small but crucial fundamental point, and all worked fine. regards, Richard On Wed, Jun 3, 2015 at 10:37 PM, richard kappler wrote: > Figu

[Tutor] line iteration in a file

2015-06-03 Thread richard kappler
not, what might be the problem and either way, how do I fix it? regards, Richard who is proving to his Linux box that he is an idiot pretty regularly -- Windows assumes you are an idiot…Linux demands proof. ___ Tutor maillist - Tutor@python.org To

Re: [Tutor] string delimiters

2015-06-03 Thread richard kappler
Perhaps the better way for me to have asked this question would have been: How can I find the location within a string of every instance of a character such as ']'? regards, Richard On Wed, Jun 3, 2015 at 5:16 PM, Alex Kleider wrote: > On 2015-06-03 12:53, Alan Gauld wrote: >

Re: [Tutor] string delimiters

2015-06-03 Thread richard kappler
I'm eager for direction. What other information would better help explain? regards, Richard On Wed, Jun 3, 2015 at 4:31 PM, Alan Gauld wrote: > On 03/06/15 21:23, richard kappler wrote: > >> hold the phone >> >> I have no idea why it worked, would love an expl

Re: [Tutor] string delimiters

2015-06-03 Thread richard kappler
lse executes so both types of lines format correctly except for the multiple identifiers in the non-icdm lines I could still use some help with that bit, please. regards, Richard On Wed, Jun 3, 2015 at 4:13 PM, richard kappler wrote: > I was trying to keep it simple, you'd think by now

Re: [Tutor] string delimiters

2015-06-03 Thread richard kappler
w to handle the differences in the end of the non-icdm files (potentially more than identifier ] delimited as described above). regards, Richard On Wed, Jun 3, 2015 at 3:53 PM, Alan Gauld wrote: > On 03/06/15 20:10, richard kappler wrote: > >> for formatting a string and adding de

[Tutor] string delimiters

2015-06-03 Thread richard kappler
and each one is identical up to the delimiter before the rest, and sometimes there is only one, sometimes there is two, they vary in length. Can I stop using position numbers and start looking for specific characters (the delimiter) and proceed to the end (which is always a con

Re: [Tutor] inserting path to open a file from a variable

2015-05-28 Thread richard kappler
ectory, it works fine, does exactly what I expected it to do (ie. opens the files). I thought it might be because because I used Doc... instead of ~/Doc... for my path, but I got the same traceback. curiouser and curiouser was, Richard On Thu, May 28, 2015 at 3:01 PM, Felix Dietrich < felix.dietr

Re: [Tutor] inserting path to open a file from a variable

2015-05-28 Thread richard kappler
;r') % (rd1) or file = os.path.open(rd1, 'r') or do I not need os.path... Kind of lost in the woods here. regards, Richard On Thu, May 28, 2015 at 1:56 PM, Alan Gauld wrote: > On 28/05/15 18:39, richard kappler wrote: > > I've created a config file which the user wo

[Tutor] inserting path to open a file from a variable

2015-05-28 Thread richard kappler
int rd1 gives me Documents/MyScripts/fileMonitor/log.txt But how in the heck do I get that into the open() statement? What I've tried (none worked): file = open(rd1, 'r') file = open('rd1', 'r') and I ran out of ideas. Help? regards, Richard -- Windows ass

Re: [Tutor] Extracting data between strings

2015-05-27 Thread richard kappler
>Hi Richard, I'm not sure how advanced you are, whether you have any experience or if you're a total beginner. If anything I say below doesn't make sense, please ask! Keep your replies on the list, and somebody will be happy to answer. In between. I've been learning Pytho

[Tutor] Extracting data between strings

2015-05-27 Thread richard kappler
well. Oh, and the painful bit is that I can't use any modules that aren't included in the initial Python install. My code is appended below. regards, Richard import time while True: #open the log file containing the data file = open('log.txt', 'r') #fi

Re: [Tutor] How to paste text from from clipboard to command line?

2015-01-21 Thread Richard D. Moores
On Wed, Jan 21, 2015 at 8:10 AM, Steven D'Aprano wrote: > https://duckduckgo.com/?q=windows+command+line+paste Ah, check QuickEdit Mode in Properties. Thanks very much. ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription option

Re: [Tutor] How to paste text from from clipboard to command line?

2015-01-21 Thread Richard D. Moores
On Wed, Jan 21, 2015 at 8:04 AM, Steven D'Aprano wrote: > Huh? Thanks for what? Please note the subject line. ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor

[Tutor] How to paste text from from clipboard to command line?

2015-01-21 Thread Richard D. Moores
Thanks, Dick Moores Python 3.4.1 Win 7 ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor

[Tutor] format command help

2014-10-07 Thread Richard Dillon
I create column headings using \t print('base1\tbase2\theight\tarea') and I would like the numbers to align with the headings. I think that I need to use format instead of doing this: print(A,' ',B,' ',C,' ',int(area1)) print(D,' ',E,' ',F,' ',int(area2)) b

[Tutor] This is driving my crazy! My file hasn't been corrupted

2014-08-31 Thread Richard Dillon
My text file has five numbers, 1-5 I don't what the problem is. I've written the file using Word (saved as .txt ) as well as TextEdit Python 3.4.1 on a Mac Here's the code: # Richard Dillon # This program reads data from a .txt file and calculates a total # data in text fi

Re: [Tutor] reading strings and calculating totals

2014-08-30 Thread Richard Dillon
When I tried total = 0 with open('/Users/richarddillon/Desktop/numbers.txt', 'r') as infile: for line in infile: total += float(line) print(total) Python returned "ValueError: could not convert string to float: " Richard On Aug 30, 2014,

[Tutor] reading strings and calculating totals

2014-08-30 Thread Richard Dillon
I apologize in advance - This is my third week using Python (3.4.1 on a Mac) I need to read a text file, convert the values into numbers and calculate a total. The total I get doesn't match the values entered in the file. def main(): total = 0 infile = open('/Users/richarddillon/Desktop/

[Tutor] Python 3.4.1 question for Mac users

2014-08-29 Thread Richard Dillon
I’m teaching myself Python 3.4.1 on a Mac and the book I’m using is written for Windows users. I’m trying to open a file on the desktop and I created a path using the example in the book. Any Mac users out there with a solution? My main drive is named “OS”. Here’s my code: def main()

Re: [Tutor] Error message

2014-08-10 Thread RICHARD KENTISH
urces richardkentish$  I installed the python files from the python site, latest version for mac. Best wishes, Richard From: Steven D'Aprano To: tutor@python.org Sent: Sunday, 10 August 2014, 12:30 Subject: Re: [Tutor] Error message On Sun, Aug 10, 201

Re: [Tutor] Error message

2014-08-10 Thread RICHARD KENTISH
help. Best wishes, Richard From: RICHARD KENTISH To: "tutor@python.org" Sent: Sunday, 10 August 2014, 10:32 Subject: [Tutor] Error message Hi! Ive installed Python 2.7.8 and pygame 1.9.1 onto a macbook pro 10.9.4 Mavericks. The code is taken

[Tutor] Error message

2014-08-10 Thread RICHARD KENTISH
Hi! Ive installed Python 2.7.8 and pygame 1.9.1 onto a macbook pro 10.9.4 Mavericks. The code is taken direct from the 'making games' book. Here it is pasted from idle: import pygame, sys from pygame.locals import * pygame.init() displaysurf = pygame.dispaly.set_mode((400, 300)) pygame.display

[Tutor] trace / profile function calls with inputs

2014-02-09 Thread Richard Cziva
similar: foo(100) math.cos(100) time.sleep(0.87) Things I have tried with only partial success: - trace module - profile module / cProfile Could you suggest me a way of doing this? Thanks, Richard ___ Tutor maillist - Tutor@python.org To unsubscribe or

[Tutor] trace / profile every function with inputs

2014-02-09 Thread Richard Cziva
: foo(100) math.cos(100) time.sleep(0.87) Things I have tried with only partial success: - trace: couldn't get the function names in some cases - profile / cProfile: no information about the arguments Could you suggest me a way of doing this?

Re: [Tutor] truncated dictionary return

2013-12-01 Thread richard kappler
Would something like if len(dict) = 8 return d else continue work? On Sun, Dec 1, 2013 at 8:54 PM, richard kappler wrote: > Now I'm completely lost. While opening the serial port outside the > function sounds like a good idea, I'm thinking that might not work unless

Re: [Tutor] truncated dictionary return

2013-12-01 Thread richard kappler
the limited understanding I do have. Again, it could be my lack of knowledge is preventing me from seeing the light here, but it feels like we're reinventing the wheel. I hope that didn't come across as rude, it truly was not intended to be such. regards, Richard On Sun, Dec 1, 2013 at

[Tutor] truncated dictionary return

2013-12-01 Thread richard kappler
eption? I've not yet delved into any of these in my quest to learn python except if/else and that doesn't feel right for this, so I'm at a loss as to how to proceed. regards, Richard -- *Mater tua criceta fuit, et pater tuo redoluit bacarum sambucus*

[Tutor] strip and split?

2013-11-30 Thread richard kappler
here I'm floundering. Might I get a little guidance on this please? regards, Richard -- *Mater tua criceta fuit, et pater tuo redoluit bacarum sambucus* ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor

[Tutor] IndexError: list index out of range

2013-11-29 Thread richard kappler
ttp://www.google.com/speech-api/v1/recognize?lang=en-us&client=chromium";' args = shlex.split(cmd) output,error = subprocess.Popen(args,stdout = subprocess.PIPE, stderr= subprocess.PIPE).communicate() if not error: a = eval(output) #a = eval(open("data.txt").read()) confidence= a['hy

Re: [Tutor] Having trouble figuring out bug

2013-02-13 Thread richard kappler
On Wed, Feb 13, 2013 at 6:56 PM, Steven D'Aprano wrote: > On 14/02/13 10:14, richard kappler wrote: > >> I have tried to run the Google speech recognition code found here: >> https://github.com/jeysonmc/**python-google-speech-scripts/** >> blob/master/stt_google.p

Re: [Tutor] Having trouble figuring out bug

2013-02-13 Thread richard kappler
'm a bit annoyed I didn't catch it. So... methinks that if I code in for the recording to end on say a second or two of silence, and get rid of the CTRL+C, then the code should proceed as necessary. Then I neeed to figure out how to make it more secure per you

[Tutor] Having trouble figuring out bug

2013-02-13 Thread richard kappler
ng into problems, could use some guidance. NOTE: I did not post the entire code here for brevity, but it is available at the listed website or, if it is preferred, I can post it in a follow-on email. regards, Richard -- quando omni flunkus moritati __

[Tutor] sending a wav file to a website?

2013-02-12 Thread richard kappler
d out that may be a different problem so will look again), but sending the wav file to the url and retrieving the text for further processing has me a bit baffled. Any ideas? regards, Richard -- quando omni flunkus moritati ___ Tutor maillist

[Tutor] sockets and networking

2013-02-11 Thread richard kappler
on the laptop. Someone suggest using sockets, with which I am completely unfamiliar. I've read the socket docs and admit I find them quite confusing. Can someone point me to a/some good beginner tutorials on sockets/networking for me to look at? regards, Richard -- quando omni flunkus mor

[Tutor] a Pygtk question sort of

2013-01-11 Thread richard kappler
point me towards a place to discuss this? The forums at Python.org are under construction, the CMUSphinx forums at Sourceforge are down (404) so I'm not quite sure where to go for help. regards, Richard #!/usr/bin/env python # Copyright (c) 2008 Carnegie Mellon University. # # You may modify

[Tutor] garbage collection/class question

2013-01-10 Thread richard kappler
So, using the above example, when the loop reaches the end and returns to the beginning, new lemons and limes are created, yes? What happens to the old ones? Or have I still got this completed boggled? regards, RIchard -- quando omni flunkus moritati ___

[Tutor] .strip question

2013-01-09 Thread richard kappler
item.strip() key, value = item.split(':') key = key.strip() value = value.strip() d[key] = float(value) return d Mind you, this is as of yet untested code, so before you ask for tracebacks, I can't give any until I figure out how to get rid

  1   2   3   4   5   6   >