Re: [Tutor] Which is better in principle: to store (in file) calculated data or to re-calculate it upon restarting program?

2019-07-31 Thread Chris Roy-Smith
On 31/7/19 2:21 am, boB Stepp wrote: I have been using various iterations of a solitaire scorekeeper program to explore different programming thoughts. In my latest musings I am wondering about -- in general -- whether it is best to store calculated data values in a file and reload these values,

Re: [Tutor] is there a graphics library for common tkinter Button functions?

2019-03-21 Thread Chris Roy-Smith
On 21/3/19 10:19 am, Alan Gauld via Tutor wrote: On 20/03/19 22:43, Chris Roy-Smith wrote: Is there a "graphics library" of common button uses? that is things like forward record, back record, 1st record, last record, printer, save and the likes. The short answer is no. But you

[Tutor] is there a graphics library for common tkinter Button functions?

2019-03-20 Thread Chris Roy-Smith
Hi, Is there a "graphics library" of common button uses? that is things like forward record, back record, 1st record, last record, printer, save and the likes. I don't have very artistic abilities, so would prefer to save making my own library. Thank you

Re: [Tutor] Tkinter: Can's figure out how to put a frame in a second window

2019-03-09 Thread Chris Roy-Smith
On 9/3/19 10:13 pm, Alan Gauld via Tutor wrote: On 09/03/2019 02:53, Chris Roy-Smith wrote: What is happening is that the contents of the frame appear in the master window. I was expecting them to show in the second window. Also I expected the frame to be sunken, but there is no obvious signs

[Tutor] Tkinter: Can's figure out how to put a frame in a second window

2019-03-09 Thread Chris Roy-Smith
. Also I expected the frame to be sunken, but there is no obvious signs of the frame, not even a colored background. What am I doing wrong? Thank you, Chris Roy-Smith here is my code: #! /usr/bin/python3 from tkinter import * def NewWindow():     sw=Toplevel(master)     sw.title('New W

Re: [Tutor] Python installtion

2019-01-13 Thread Stephen Nelson-Smith
Hi, On Mon, Jan 7, 2019 at 11:11 AM mousumi sahu wrote: > > Dear Sir, > I am trying to install python 2.7.10 on HPC. Python 2.6 has already been > install on root. I do not have root authority. Please suggest me how can I > do this. Sorry - I replied to you directly, by accident. Take 2, with r

Re: [Tutor] Debugging a sort error.

2019-01-13 Thread Stephen Nelson-Smith
Hi, On Sun, Jan 13, 2019 at 8:34 AM wrote: > description.sort() > TypeError: unorderable types: float() < str() So, fairly obviously, we can't test whether a float is less than a string. Any more than we can tell if a grapefruit is faster than a cheetah. So there must be items in description

[Tutor] Performance Issue

2018-10-17 Thread Stephen Smith
I have written a screen scraping program that watches a clock (on the app's server) and at 7:00:00 AM dashes to make a reservation on line. It works fine. However, i have spent time trying to improve its performance. I am using selenium, with chrome driver. Here is what i have learned. I have tri

Re: [Tutor] Help understanding base64 decoding

2018-09-13 Thread Ryan Smith
being encoded in UTF-8. Hence I'm guessing is the reason for converting strings to a bytes object in the first place. Again thank you for the assistance! Ryan On Thu, Sep 13, 2018 at 2:57 AM, Peter Otten <__pete...@web.de> wrote: > Ryan Smith wrote: > >> Hello All, >> &g

[Tutor] Help understanding base64 decoding

2018-09-12 Thread Ryan Smith
Hello All, I am currently working on a small utility that finds any base64 encoded strings in files and decodes them. I am having issue understanding how the Base64 module actually works. The regular expression that I am using correctly matches on the encoded strings. I simply want to be able to c

[Tutor] why can use a widget assigned to a variable or just use it on it's own?

2018-07-02 Thread Chris Roy-Smith
'hello' :print(a)).grid(row=0, column=0) main.mainloop() === any explanation gratefully recieved Regards, Chris ROy-Smith ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] how to change the command "string" on a tkinter Button?

2018-07-01 Thread Chris Roy-Smith
On 01/07/18 19:19, Steven D'Aprano wrote: On Sun, Jul 01, 2018 at 03:32:59PM +1000, Chris Roy-Smith wrote: Python is the first language I have attempted since macro assembler for CP/M. Python seems to be another world. Yes indeed, high-level languages like Python *are* a radically diff

Re: [Tutor] how to change the command "string" on a tkinter Button?

2018-07-01 Thread Chris Roy-Smith
On 01/07/18 02:17, Alan Gauld via Tutor wrote: On 30/06/18 03:55, Chris Roy-Smith wrote: I am trying to change the command of a tkinter Button in my program. Eventually I want to be able to do this to many buttons. Since I'm not 100% sure if you mean the command or the label or both here

Re: [Tutor] how to change the command "string" on a tkinter Button?

2018-07-01 Thread Chris Roy-Smith
On 01/07/18 02:17, Alan Gauld via Tutor wrote: On 30/06/18 03:55, Chris Roy-Smith wrote: I am trying to change the command of a tkinter Button in my program. Eventually I want to be able to do this to many buttons. Since I'm not 100% sure if you mean the command or the label or both here

[Tutor] how to change the command "string" on a tkinter Button?

2018-06-30 Thread Chris Roy-Smith
I do this, I had worked around the problem by destroying  the window and building it again, but it was pointed out that I have an unusual coding style doing this. All hints appreciated! Regards, Chris Roy-Smith ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] tkinter code executes before function returned

2018-04-16 Thread Chris Roy-Smith
On 15/04/18 18:10, Alan Gauld via Tutor wrote: On 15/04/18 03:57, Chris Roy-Smith wrote: I am trying to get tkinter to return a number from a window, which then sets how many times to print a sign. I don;t jhave time to look at this in detail just now, maybe later. But first impressions is

Re: [Tutor] tkinter code executes before function returned

2018-04-15 Thread Chris Roy-Smith
ons after that. Regards, Chris Roy-Smith ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor

[Tutor] tkinter code executes before function returned

2018-04-15 Thread Chris Roy-Smith
gn code to wait till getcount() returns it's value? Any help greatly appreciated. Regards, Chris Roy-Smith chris@chris-X451MA:~/Scripts/python3/dvms$ ./debug1.py line 27 ###   required sign count for D is None   ### Exception in Tkinter callback Traceback (most recent call last):   File "/

[Tutor] thinter: can't figure out how to update a window instead of creating a new on

2018-01-28 Thread Chris Roy-Smith
r any assistance, I'm hoping to learn something from this experience Regards, Chris Roy-Smith #!/usr/bin/python3 import mysql.connector from tkinter import * import pickle master = Tk() def getCfg():     fobj = open('members.pkl', 'rb')     cfg = pickle.load(fobj)  

[Tutor] Fwd: print a for loop system call

2018-01-20 Thread Derek Smith
Sent from my iPhone Begin forwarded message: From: Derek Smith mailto:dereksm...@racksquared.com>> Date: January 19, 2018 at 4:01:58 PM EST To: "tutor-requ...@python.org<mailto:tutor-requ...@python.org>" mailto:tutor-requ...@python.org>> Subject: print a for loop

Re: [Tutor] trouble using tkinter CheckButton

2018-01-16 Thread Chris Roy-Smith
On 16/01/18 22:35, Alan Gauld via Tutor wrote: On 16/01/18 04:37, Chris Roy-Smith wrote:   File "./debugString.py", line 7, in SetFin     SetStatus[x] = var.get(x) AttributeError: 'list' object has no attribute 'get' var=[IntVar() for x in range(8)] He

[Tutor] trouble using tkinter CheckButton

2018-01-16 Thread Chris Roy-Smith
broken things down to what I think is as simple as I can get. Thank you for looking at this, Regards, Chris Roy-Smith Error message: = chris@chris-X451MA:~/Scripts/python3/dvms$ ./debugString.py Exception in Tkinter callback Traceback (most recent call last):   File

[Tutor] get javascript output data from ssi file

2017-11-27 Thread Derek Smith
31 (1)   Slot 32 (1)   Slot 35 (1)   Slot 36 (1)   Slot 37 (1)   Slot 40 (1)   Slot 41 (1)   Slot 44 (1)   Derek Smith

Re: [Tutor] problems using a listbox

2017-10-17 Thread Chris Roy-Smith
log.list.insert(END, item) mainloop() Thank you, that works, I have difficulties with object oriented coding. Never used a language where I needed it. Regards, Chris Roy-Smith ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor

[Tutor] problems using a listbox

2017-10-17 Thread Chris Roy-Smith
/listbox.py selection is .140537834621024 Thank you for any help Regards, Chris Roy-Smith ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor

[Tutor] subprocess check_output

2017-09-20 Thread Derek Smith
", "status='Scratch'", "and", "library_name='TS3200'" ] ) print (scratch) __OUTPUT__ # ./ts3200_scratchcount_check.py email sent successfully b' 8\n' Thx!! Derek Smith | Unix/TSM Administrator | Racksquared Data Centers :: dere

[Tutor] pip install of subprocess module

2017-09-18 Thread Derek Smith
ine 707, in call_subprocess % (command_desc, proc.returncode, cwd)) pip.exceptions.InstallationError: Command "git clone -q https://github.com/python/cpython/blob/3.6/Lib/subprocess.py /tmp/pip-bw8rryo9-build" failed with error code 128 in None Derek Smith |

[Tutor] array input from keyboard

2017-09-15 Thread Derek Smith
I need to accept input from the user then store in an array/list. This is my 1st python script. #!/usr/bin/env python # Derek Smith # 09/2017 # accept volumes for TSM for tape mgmt. import os import sys nput1 = "" nput2 = "" nput1 = input("\nIs your input 'file

[Tutor] intro book for python

2017-09-01 Thread Derek Smith
Hello! I am new to python coming from a Perl and Unix Admin background. I reviewed the site https://wiki.python.org/moin/IntroductoryBooks and would like to know which book(s) you all recommended for a newbie? Thank you! ___ Tutor maillist - Tuto

[Tutor] Python Questions

2017-07-18 Thread Max Smith
I have some questions about python. What's the easiest way to learn python currently I'm using google's excersise program, I'm just reading and making notes then testing out what I have learnt. Since I' need to understand python fully as I've got a exam in Python for my GCSE's if you could gi

Re: [Tutor] Coming from R, what's a good IDE editor? I've tried PyCharm and Spyder

2017-06-05 Thread Ryan Smith
+1 for Wing IDE. I have been using it for about 6-7 months now and absolutely love it. Ryan On Sun, Jun 4, 2017 at 11:37 AM Ryan Smith wrote: > > On Sun, Jun 4, 2017 at 8:13 AM wolfrage8...@gmail.com < > wolfrage8...@gmail.com> wrote: > >> Atom.io Editor is my curre

Re: [Tutor] feedback on simple python code

2017-03-02 Thread Ryan Smith
On 2/28/17, 3:32 AM, "Tutor on behalf of Peter Otten" wrote: >Ryan Smith wrote: > >> Hi all, >> >> New python student here. I have been using O¹reilly¹s "Python Beyond the >> Basics: Object Oriented Programming video series". In one of the &

[Tutor] feedback on simple python code

2017-02-27 Thread Ryan Smith
Hi all, New python student here. I have been using O¹reilly¹s "Python Beyond the Basics: Object Oriented Programming video series". In one of the assignments we are to write a simple inheritance hierarchy of three classes that write to text files. I have actually written the code for the assignmen

Re: [Tutor] Need help

2016-10-13 Thread Ryan Smith
On Wednesday, October 12, 2016, Alan Gauld via Tutor wrote: > On 12/10/16 09:03, niraj pandey wrote: > > > Can you pls guide how to print this screen (Attached here) content in > > printer ? > > As we already pointed out this is a text list so attachments > are usually stripped off... > > However

Re: [Tutor] is there a better way to do this?

2016-05-10 Thread Chris Roy-Smith
On 10/05/16 07:03, Ondřej Rusek wrote: Dne 9.5.2016 v 10:13 Chris Roy-Smith napsal(a): Hi Python 3.4 Linux (ubuntu) This code does what I want. curs is the result of a mysql query data = [[" " for x in range(9)] for y in range(count)] for (ddate, mood, walk, lag, sleep) in curs:

Re: [Tutor] is there a better way to do this?

2016-05-10 Thread Chris Roy-Smith
On 10/05/16 12:01, Steven D'Aprano wrote: On Mon, May 09, 2016 at 06:13:32PM +1000, Chris Roy-Smith wrote: data = [[" " for x in range(9)] for y in range(count)] for (ddate, mood, walk, lag, sleep) in curs: data[row][0]=ddate data[row][1]=mood da

[Tutor] is there a better way to do this?

2016-05-09 Thread Chris Roy-Smith
ata[row][3]=lag data[row][4]=sleep row +=1 While I don't know a better way to do this, it seems a bit awkward, is there a better way? Thank you Chris Roy-Smith ___ Tutor maillist - Tutor@python.org To unsubscribe or change subsc

[Tutor] Python "password" securely hashed in script

2016-04-27 Thread Paul Smith
So creating small programs that automate my day specifically logins, how can one "hash" or hide the user and pass items in the python script itself? I need to prevent someone from easily seeing or accessing these if they happen to gain access to my python files. Thanks in advance. _

Re: [Tutor] Why define a function inside a function?

2016-01-30 Thread Ryan Smith
Thank you to both you and Ben for taking the time and answering my question! The detailed explanation of the example code I provided really helped and made things clear. As did the explanations about closures and a simplified example. I definitely have a lot to learn, but this was very educational

[Tutor] Why define a function inside a function?

2016-01-29 Thread Ryan Smith
Hi all, I am new to programming and python and had a question. I hope I articulate this well enough so here it goes... I was following along on a thread on this mailing list discussing how to test file I/O operations. In one of the suggested solutions the following code was used: def _open_as_st

Re: [Tutor] Why does this function execute before being called?

2015-11-07 Thread Chris Roy-Smith
On 07/11/15 20:18, Alan Gauld wrote: On 07/11/15 04:34, Chris Roy-Smith wrote: def genF(ofield): ... for x in range(10): def second(): main=Toplevel(root) ofield=Text(main, height=15, width=15) ofield.pack() B3=Button(main, text='exit', command=main.destro

[Tutor] Why does this function execute before being called?

2015-11-07 Thread Chris Roy-Smith
Hi, Environment: Python 2.7 Linux (Ubuntu 15.10) I am experiencing a problem with the code below running the "genF" function on opening the second window. I expected that function to be executed on clicking the 'fill text' button. The text widget gets filled on opening the window. This is my f

Re: [Tutor] Mutable data type in python

2015-10-03 Thread C Smith
On Sat, Oct 3, 2015 at 11:55 AM, Alan Gauld wrote: > On 03/10/15 19:10, C Smith wrote: >>> >>> Here is my modified version which I think works as you want: >>> >>> def findMinDepthPath(n): >>> if n <= 0: raise ValueError >>>

Re: [Tutor] Mutable data type in python

2015-10-03 Thread C Smith
> Here is my modified version which I think works as you want: > > def findMinDepthPath(n): > if n <= 0: raise ValueError > elif n==1: > return 0 > elif n==2 or n==3: > return 1 > else: > d1 = findMinDepthPath(n-1)+1 > d2 = d3 = (d1+1) # initialize to

Re: [Tutor] Python type confusion?

2015-09-28 Thread C Smith
On Mon, Sep 28, 2015 at 4:13 PM, C Smith wrote: > On Mon, Sep 28, 2015 at 1:27 PM, Ken Hammer wrote: >> A simple "type" problem? >> >> The following code works as a py file with the XX'd lines replacing the two >> later "raw_input" lines. >

Re: [Tutor] Python type confusion?

2015-09-28 Thread C Smith
On Mon, Sep 28, 2015 at 1:27 PM, Ken Hammer wrote: > A simple "type" problem? > > The following code works as a py file with the XX'd lines replacing the two > later "raw_input" lines. > Why do the "raw_input" lines yield a TypeError: 'str' object is not callable? > Same result if I use/omit >

Re: [Tutor] [Tkinter-discuss] tkinter file dialog pattern matching (fwd)

2015-08-24 Thread Chris Roy-Smith
On 23/08/15 23:52, Laura Creighton wrote: oooh. Seems that there is an undocumented feature we can use! Laura --- Forwarded Message Return-Path: Date: Sun, 23 Aug 2015 12:40:02 +0200 From: Michael Lange To: tkinter-disc...@python.org Message-Id: <20150823124002.7391f37e21f9b5cfaa917...@

Re: [Tutor] filtering listed directories

2015-08-23 Thread Chris Roy-Smith
On 23/08/15 18:13, Laura Creighton wrote: In a message of Sun, 23 Aug 2015 13:09:41 +1000, Chris Roy-Smith writes: On 22/08/15 23:32, Alan Gauld wrote: On 22/08/15 11:43, Laura Creighton wrote: How can I filter out these hidden directories? Help(tkFileDialog) doesn't help me as it just

Re: [Tutor] filtering listed directories

2015-08-23 Thread Chris Roy-Smith
On 23/08/15 00:42, Laura Creighton wrote: In a message of Sat, 22 Aug 2015 14:32:56 +0100, Alan Gauld writes: But maybe some questions on a Tix (or Tk) forum might get more help? Once you know how to do it in native Tcl/Tk/Tix you can usually figure out how to do it in Python. -- Alan G I ask

Re: [Tutor] filtering listed directories

2015-08-23 Thread Chris Roy-Smith
On 22/08/15 23:32, Alan Gauld wrote: On 22/08/15 11:43, Laura Creighton wrote: How can I filter out these hidden directories? Help(tkFileDialog) doesn't help me as it just shows **options, but doesn't show what these options might be. tix (tkinter extensions) https://wiki.python.org/moin/Tix

[Tutor] filtering listed directories

2015-08-22 Thread Chris Roy-Smith
Hi, environment: Python 2.7, Ubuntu 12.4 Linux I am trying to get the list of directories shown by tkFileDialog.askdirectory to not show hidden files (starting with .) this code results in lots of hidden directories listed in the interface making things harder than they need to be for the use

Re: [Tutor] Abs

2015-07-27 Thread Chris Roy-Smith
On 27/07/15 11:06, Job wrote: I want to be able to ask a user to input an integer and print out the root and power of the given integer. Why do you use abs(x) for this program? I don't understand or see the link between abs() and root and powers. This reminds me of this: By knowing that when

Re: [Tutor] tkinter window not showing max, min and close buttons

2015-07-21 Thread Chris Roy-Smith
On 22/07/15 08:07, Chris Roy-Smith wrote: On 21/07/15 21:52, Alan Gauld wrote: On 21/07/15 08:15, Chris Roy-Smith wrote: On 21/07/15 17:02, Alan Gauld wrote: On 21/07/15 06:05, Chris Roy-Smith wrote: I am working my way through Alan Gauld's tutorial and have just started the section o

Re: [Tutor] tkinter window not showing max, min and close buttons

2015-07-21 Thread Chris Roy-Smith
On 21/07/15 21:52, Alan Gauld wrote: On 21/07/15 08:15, Chris Roy-Smith wrote: On 21/07/15 17:02, Alan Gauld wrote: On 21/07/15 06:05, Chris Roy-Smith wrote: I am working my way through Alan Gauld's tutorial and have just started the section on GUI. The windows that are created look odd

Re: [Tutor] tkinter window not showing max, min and close buttons

2015-07-21 Thread Chris Roy-Smith
On 21/07/15 17:02, Alan Gauld wrote: On 21/07/15 06:05, Chris Roy-Smith wrote: I am working my way through Alan Gauld's tutorial and have just started the section on GUI. The windows that are created look odd with no title bar or maximise, minimise or close window button. The sim

[Tutor] tkinter window not showing max, min and close buttons

2015-07-20 Thread Chris Roy-Smith
orial? Thank you Chris Roy-Smith ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor

[Tutor] Sorting a list of list

2015-06-05 Thread Stephen Nelson-Smith
As part of my league secretary program (to which thread I shall reply again shortly), I need to sort a list of lists. I've worked out that I can use sorted() and operator.itemgetter to sort by a value at a known position in each list. Is it possible to do this at a secondary level? So if the ite

Re: [Tutor] League Secretary Application

2015-05-30 Thread Stephen Nelson-Smith
Hullo, On Sat, May 30, 2015 at 3:49 PM, Laura Creighton wrote: > > 2. How do you receive your data now? Do you want to change this, > perhaps extend the capabilities -- i.e. let people send an sms > with results to your cell phone? Or limit the capabilities ("Stop > phoning me wit

[Tutor] League Secretary Application

2015-05-30 Thread Stephen Nelson-Smith
loggs Player B: Nora Batty Player X: Jim Smith Player Y: Edna Jones A vs X: 3-0 B vs Y: 3-2 A vs Y: 3-0 B vs X: 3-2 Doubles: 3-1 >From this I can calculate the points allocated to teams and produce a table. I've not done any real python for about 6 years, but figured it'd be fun t

[Tutor] Umm.. I need help on changing Global Variables.

2015-01-29 Thread Tallen Grey Smith
So, I’m trying to make a very simple game that involves time management properly, but I’m having an issue. level = 1 player_health = 100 enemy_health = 100 steps = 10 civilians = 20 charge = 0 name_2 = 'Bob' def game(): global level global player_health global enemy_health globa

Re: [Tutor] Ideas for Child's Project

2015-01-07 Thread Stephen Nelson-Smith
Hi Danny, On Tue, Jan 6, 2015 at 10:07 PM, Danny Yoo wrote: > On Tue, Jan 6, 2015 at 1:46 PM, Stephen Nelson-Smith > wrote: > > You might want to look at Bootstrapworld, a curriculum for > middle-school/high-school math using programming and games: > > http://w

[Tutor] Ideas for Child's Project

2015-01-06 Thread Stephen Nelson-Smith
Hello, My son is interested in programming, and has dabbled in Scratch and done a tiny bit of Python at school. He's 11 and is going for an entrance exam for a selective school in a couple of weeks. They've asked him to bring along something to demonstrate an interest, and present it to them. I

Re: [Tutor] Tutor Digest, Vol 129, Issue 22

2014-11-11 Thread Ben Smith
Hi - I'm a teacher & sometimes when we're holding a two minute silence for an important occasion an email comes through & makes my computer ping loudly. Is there a python script to stop these kind of things happening? ;) -Original Message- From: Tutor [mailto:tutor-bounces+ben.smith=arn

[Tutor] Whack-a-mole

2014-10-01 Thread Ben Smith
Hi, Can anyone help explain why you can keep hitting the Mole even when hittable should be False? from tkinter import * root = Tk() #root.state('zoomed') sec = 0 points=0 pic=PhotoImage(file='Dirt.gif') pic2=PhotoImage(file='Mole.gif') hittable=False def HIT(): if hittable==True: gl

[Tutor] Module? Error handling specific to SQLite3

2014-09-26 Thread Paul Smith
Ok Tutor help please... Early stages messing with module sqlite3 in python3.4. I am successful in creating sqlite tables of my own and interacting with other sqlite tables, however in refining the code from a purely "it can do it" stage to a more stable working piece of code I run into this proble

Re: [Tutor] Help

2014-09-18 Thread C Smith
Check this guy's youtube channel. He has very basic examples. His username is thenewboston On Wed, Sep 17, 2014 at 4:36 PM, Art Pelletier wrote: > > I am a beginner with pythons programming I would like to see if their is a > site that has samples programs that I can practice on. > Sent from m

Re: [Tutor] Using subprocess on a series of files with spaces

2014-08-01 Thread C Smith
rote: > >>You may have already have solved your problem, unfortunately my >>emails are coming in slowly and out of order, but I have a suggestion: >> >>On Thu, Jul 31, 2014 at 03:53:48PM -0400, C Smith wrote: >>> I am on OSX, which needs to escape spaces in fil

Re: [Tutor] Using subprocess on a series of files with spaces

2014-08-01 Thread C Smith
4:38 AM, Ben Finney wrote: > Peter Otten <__pete...@web.de> writes: > >> C Smith wrote: >> >> > Nice, these are useful tools. I have been building something with >> > just basic stuff and avoiding learning any libraries. If I wanted to >> > get s

Re: [Tutor] Using subprocess on a series of files with spaces

2014-07-31 Thread C Smith
wrote: > C Smith wrote: > > I'd throw in a check to verify that filename is indeed a flac: > >> or more accurately >> import os, subprocess, re >> directory = '/abs/path' >> for track, filename in enumerate(os.listdir(directory), 1): >&

Re: [Tutor] Using subprocess on a series of files with spaces

2014-07-31 Thread C Smith
or more accurately import os, subprocess, re directory = '/abs/path' for track, filename in enumerate(os.listdir(directory), 1): pathname = os.path.join(directory, filename) subprocess.call(['ffmpeg', '-i', pathname, filename[:-5]+'.mp3']) On Thu,

Re: [Tutor] Using subprocess on a series of files with spaces

2014-07-31 Thread C Smith
thanks, got it import os, subprocess, re directory = 'abs/path' for track, filename in enumerate(os.listdir(directory), 1): pathname = os.path.join(directory, filename) subprocess.call(['ffmpeg', '-i', pathname, filename+str(track)+'.mp3']) On Thu,

Re: [Tutor] Using subprocess on a series of files with spaces

2014-07-31 Thread C Smith
Huh, that is quite an annoyance about changing the order though. Any ideas about that? I will look into it further in the meantime... On Thu, Jul 31, 2014 at 6:57 PM, C Smith wrote: > Works now, thanks! > > On Thu, Jul 31, 2014 at 6:57 PM, C Smith wrote: >> woops, I see it pathn

Re: [Tutor] Using subprocess on a series of files with spaces

2014-07-31 Thread C Smith
Works now, thanks! On Thu, Jul 31, 2014 at 6:57 PM, C Smith wrote: > woops, I see it pathname != filename > > On Thu, Jul 31, 2014 at 6:55 PM, C Smith wrote: >>>for track, filename in enumerate(os.listdir(directory), 1): >> It seems kinda counter-intuitive to hav

Re: [Tutor] Using subprocess on a series of files with spaces

2014-07-31 Thread C Smith
woops, I see it pathname != filename On Thu, Jul 31, 2014 at 6:55 PM, C Smith wrote: >>for track, filename in enumerate(os.listdir(directory), 1): > It seems kinda counter-intuitive to have track then filename as > variables, but enumerate looks like it gets passed the filename

Re: [Tutor] Using subprocess on a series of files with spaces

2014-07-31 Thread C Smith
> emails are coming in slowly and out of order, but I have a suggestion: > > On Thu, Jul 31, 2014 at 03:53:48PM -0400, C Smith wrote: >> I am on OSX, which needs to escape spaces in filenames with a backslash. > > Same as any other Unix, or Linux, or, indeed, Windows. > >

Re: [Tutor] Using subprocess on a series of files with spaces

2014-07-31 Thread C Smith
. So, I am still wondering about that too. On Thu, Jul 31, 2014 at 6:20 PM, C Smith wrote: > Okay I messed up with slash instead of backslash, so the re.sub() > works, but I am still curious about the previous question. > > On Thu, Jul 31, 2014 at 6:14 PM, C Smith wrote: >> Ev

Re: [Tutor] Using subprocess on a series of files with spaces

2014-07-31 Thread C Smith
Okay I messed up with slash instead of backslash, so the re.sub() works, but I am still curious about the previous question. On Thu, Jul 31, 2014 at 6:14 PM, C Smith wrote: > Even when I am using: > re.sub('/s', '\\/s', filename) > I am still getting the same outp

Re: [Tutor] Using subprocess on a series of files with spaces

2014-07-31 Thread C Smith
e Python interpreter strip off backslashes or something with strings? On Thu, Jul 31, 2014 at 5:53 PM, C Smith wrote: >>Change: > > >>subprocess.call(['ffmpeg', '-i', filename, str(track)+'.mp3']) > >>to: > >>subprocess.call(['ffmpeg

Re: [Tutor] Using subprocess on a series of files with spaces

2014-07-31 Thread C Smith
passed to the shell without escaping the spaces. >Why not using ffmpeg without jumping into Python. It's well documented, check >Google. I guess you mean that the ability to change multiple files with ffmpeg is possible. I hadn't considered that but I would rather do it with Python,

[Tutor] Using subprocess on a series of files with spaces

2014-07-31 Thread C Smith
I am on OSX, which needs to escape spaces in filenames with a backslash. There are multiple files within one directory that all have the same structure, one or more characters with zero or more spaces in the filename, like this: 3 Song Title XYZ.flac. I want to use Python to call ffmpeg to convert

Re: [Tutor] Why is Quick Search at docs.Python.org so useless?

2014-07-05 Thread C Smith
I agree very much. I feel like I might have a learning disability when I try to reference the official Python docs for something that seems like it should be a very common task. On Sat, Jul 5, 2014 at 1:31 PM, Deb Wyatt wrote: > I am betting that a big reason newbies don't go straight to document

Re: [Tutor] What are your favourite unofficial resources

2014-06-30 Thread C Smith
Learning Python Design Patterns, by Gennadiy Zlobin Let us know when your book is done! On Mon, Jun 30, 2014 at 7:05 AM, Bob Williams wrote: > -BEGIN PGP SIGNED MESSAGE- > Hash: SHA1 > > On 29/06/14 23:41, Alan Gauld wrote: >> I'm looking for tips for an appendix to a book that I'm workin

Re: [Tutor] Doubts about installing python3.1 in squeeze

2014-05-22 Thread C Smith
You can't use apt-get or similar to install 3.1. You will need to virtualenv. On Thu, May 22, 2014 at 12:22 PM, Alex Kleider wrote: > On 2014-05-22 06:17, Markos wrote: >> >> Hi, >> >> I'm learning Python and I'm using Debian 6.0 (squeeze) >> >> The installed version is 2.6.6. (python -V) >> >> I

Re: [Tutor] Doubts about installing python3.1 in squeeze

2014-05-22 Thread C Smith
Sorry, typing is hard. *You will need to use virtualenv On Thu, May 22, 2014 at 2:40 PM, C Smith wrote: > You can't use apt-get or similar to install 3.1. > You will need to virtualenv. > > On Thu, May 22, 2014 at 12:22 PM, Alex Kleider wrote: >> On 2014-05-22 06:17, M

Re: [Tutor] While truth

2014-05-20 Thread C Smith
Of course that isn't very useful code. I thought it might be a useful quick test for someone learning how while loops treat different values. On Tue, May 20, 2014 at 2:46 PM, Danny Yoo wrote: > On Tue, May 20, 2014 at 11:44 AM, C Smith > wrote: >> You can test out a condition

Re: [Tutor] While truth

2014-05-20 Thread C Smith
You can test out a condition like this in IDLE like so: while 6: print "yes its true" break while 0: print "yes its true" break while -1: print "yes its true" break emptyList = [] while emtpyList: print "yes its true" break This way you don't have to deal with

Re: [Tutor] Translator - multiple choice answer

2014-05-14 Thread C Smith
This might be useful for reading values from a text value into a dictionary: https://stackoverflow.com/questions/17775273/how-to-read-and-store-values-from-a-text-file-into-a-dictionary-python On Wed, May 14, 2014 at 7:00 PM, Danny Yoo wrote: >> Program read TXT file (c:\\slo3.txt) >> In this fil

Re: [Tutor] for the error about 'import site' failed; use -v for traceback

2014-05-14 Thread C Smith
What are you trying to do? On Wed, May 14, 2014 at 12:24 PM, C Smith wrote: > That looks pretty normal. I don't see any errors. > > On Wed, May 14, 2014 at 5:42 AM, Tao Zhu wrote: >> Hi everyone, >> when I use python, the problem occured. when I used the command "

Re: [Tutor] for the error about 'import site' failed; use -v for traceback

2014-05-14 Thread C Smith
That looks pretty normal. I don't see any errors. On Wed, May 14, 2014 at 5:42 AM, Tao Zhu wrote: > Hi everyone, > when I use python, the problem occured. when I used the command "python -v", > the results are listed as follows. could you tell me what wrong? > > $ python -v > # installing zipimpo

Re: [Tutor] Real world experience

2014-05-12 Thread C Smith
I think that is going to be my new wallpaper. On Mon, May 12, 2014 at 8:25 PM, Martin A. Brown wrote: > > Hello, > > 10 Pick one favorite specific topic, any topic (XML parsing; Unix > process handling; databases). The topic matters for you. > Learn it deeply. Keep learning it. The

Re: [Tutor] Real world experience

2014-05-12 Thread C Smith
Freeside is more makers. I haven't gone but have known people that have. You might find some arduino supposedly, but not much coding otherwise and you have to pay membership fees. It is more social than technical, I think. And your car will probably be broken into. I will check out the python-atlan

Re: [Tutor] Real world experience

2014-05-12 Thread C Smith
Thanks to everyone. >> practice. That programming doesn't have to be a solitary thing needs >> to be strongly emphasized, because the media likes to exaggerate, >Yes, This can't be stressed too much. Industrial coding is a team activity not >a solo process. This is particularly good advice for

Re: [Tutor] Real world experience

2014-05-11 Thread C Smith
to the industry. > > If you want to pursue a career in IT, you need to finish high school. You > would be wise to get a degree. > > My $0.02. > > Tim > > > On Sun, May 11, 2014 at 7:12 PM, C Smith > wrote: >> >> I have never known anyone that works i

[Tutor] Real world experience

2014-05-11 Thread C Smith
I have never known anyone that works in this industry. I got one job transforming xml (should have used xslt, ended up using sed and python regex scripts) where the guy asked me how much I wanted and I threw 200 bucks out there because I could get a room for two weeks at that cost. He just laughed

Re: [Tutor] Help with Python

2014-05-11 Thread C Smith
Hey Glen, include the error you are getting. It will make answering your question easier. How are you running this program, in an IDE? On Sat, May 10, 2014 at 11:16 PM, Glen Chan wrote: > Hello, I am a student trying to figure out Python. I am getting errors that > I don't know how to fix. What d

Re: [Tutor] How inefficient is this code?

2014-05-07 Thread C Smith
I guess intuiting efficiency doesn't work in Python because it is such high-level? Or is there much more going on there? ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] How inefficient is this code?

2014-05-07 Thread C Smith
eturn (or reaches the end of its body), the > for loop ends. > > This is called a generator function, and is a really nice way to > simplify and optimize your loops. > > You can read more about generators here: > https://wiki.python.org/moin/Generators > > > On Wed,

[Tutor] How inefficient is this code?

2014-05-07 Thread C Smith
A topic came up on slashdot concerning "intermediate" programming, where the poster expressed the feeling that the easy stuff is too easy and the hard stuff is too hard. Someone did point out that 'intermediate' programming would still involve actually selling code or at least some professional ex

Re: [Tutor] Stephen Mik-Novice Python Programmer(Version 3.4.0)Can't get help using Dictionaries, Lists to 'Hangman Game Problem"

2014-05-05 Thread C Smith
ode, pseudo code,worries about > using Dictionaries,Lists.embedded while lists,for loops: > Thank you,. C. Smith for responding to my help plea on Python-Tutor.org. One > version of the "Hang Man" problem is listed in the textbook,but it doesn't > use Dictionaries,Lists,embedded w

Re: [Tutor] Alice_in_wonderland Question

2014-05-04 Thread C Smith
>ordered_keys = word_count.keys() >sorted(ordered_keys) sorted() does not modify the list, but returns a sorted version of the list for me on Python 2.7 my_sorted_list = sorted(ordered_keys) This will alphabetize all of the words, regardless of frequency. >print ("All the words and their frequenc

  1   2   3   4   5   >