[Tutor] How to test my code's interactions with SQLite db?

2015-08-15 Thread boB Stepp
Being committed to TDD for this project, I am not yet ready to write code till I figure out how to write the tests. It occurs to me that writing tests for code that interacts with the SQLite db may be non-trivial (At least for me!). After doing some online research tonight, it appears that I need

Re: [Tutor] Where should unit test files go in a project directory structure and some related questions?

2015-08-15 Thread boB Stepp
On Sat, Aug 15, 2015 at 9:10 PM, boB Stepp wrote: > Right now I am trying to figure out how to arrange my unit test > file(s). My initial thoughts are to have a single test directory with > separate subdirectories corresponding to each folder which has source > code. Is this a good way to do th

Re: [Tutor] variable existence q

2015-08-15 Thread Clayton Kirkwood
> -Original Message- > From: Tutor [mailto:tutor-bounces+crk=godblessthe...@python.org] On > Behalf Of Mark Lawrence > Sent: Saturday, August 15, 2015 4:05 PM > To: tutor@python.org > Subject: Re: [Tutor] variable existence q > > On 15/08/2015 23:38, Clayton Kirkwood wrote: > > top_direc

Re: [Tutor] variable naming conventions

2015-08-15 Thread Cameron Simpson
On 15Aug2015 18:24, D Wyatt wrote: It seems every book I read these days uses camel case for variable names in Python. I was once told that using underscores is preferred. Is there a preference in the Python community or does it really matter? I'd like to instill good habits while I'm learnin

[Tutor] Where should unit test files go in a project directory structure and some related questions?

2015-08-15 Thread boB Stepp
In this Montessori Classroom Project (mcm) I am working on, I hope to incorporate as much of the advice I've gotten here as I can remember. So I want to do version control, TDD, etc., and do it as well as I can. Especially since this thing looks to grow considerably over time. I have not ever tho

Re: [Tutor] variable naming conventions

2015-08-15 Thread Mark Lawrence
On 16/08/2015 02:24, D Wyatt wrote: It seems every book I read these days uses camel case for variable names in Python. I was once told that using underscores is preferred. Is there a preference in the Python community or does it really matter? I'd like to instill good habits while I'm learnin

Re: [Tutor] variable naming conventions

2015-08-15 Thread Joel Goldstick
On Sat, Aug 15, 2015 at 9:24 PM, D Wyatt wrote: > It seems every book I read these days uses camel case for variable names in > Python. I was once told that using underscores is preferred. Is there a > preference in the Python community or does it really matter? I'd like to > instill good habit

[Tutor] variable naming conventions

2015-08-15 Thread D Wyatt
It seems every book I read these days uses camel case for variable names in Python. I was once told that using underscores is preferred. Is there a preference in the Python community or does it really matter? I'd like to instill good habits while I'm learning. Thanks in advance, -- Deb Wyatt i

Re: [Tutor] try and file existence

2015-08-15 Thread boB Stepp
On Sat, Aug 15, 2015 at 6:41 PM, Steven D'Aprano wrote: > On Sat, Aug 15, 2015 at 02:24:21PM -0500, boB Stepp wrote: >> I understand your points, but wonder then what is the intended use for >> os.path.exists()? That is, in what types of circumstances would it be >> both appropriate and safe to

Re: [Tutor] try and file existence

2015-08-15 Thread Steven D'Aprano
On Sat, Aug 15, 2015 at 02:24:21PM -0500, boB Stepp wrote: > On Fri, Aug 14, 2015 at 10:39 PM, Steven D'Aprano wrote: > > There is also os.path.exists(filename), but you should avoid using that > > if possible. The problem is this: > > > > if os.path.exists(filename): > > # file exists *right

[Tutor] How best to determine if a db exists before trying to open it? [Was: try and file existence]

2015-08-15 Thread boB Stepp
On Sat, Aug 15, 2015 at 6:00 PM, Cameron Simpson wrote: > On 15Aug2015 15:20, Clayton Kirkwood wrote: >>> >>> Behalf Of Laura Creighton > > [..] >>> >>> To: boB Stepp >>> In a message of Sat, 15 Aug 2015 14:24:21 -0500, boB Stepp writes: >>> >I understand your points, but wonder then what is the

Re: [Tutor] variable existence q

2015-08-15 Thread Mark Lawrence
On 15/08/2015 23:38, Clayton Kirkwood wrote: top_directory = "/users/Clayton/Pictures" target_directory = top_directory #directory we are checking filetypes = ('jpg', 'png', 'avi', 'mp4', 'mov', 'bmp') imports... def override_defaults(): with open( user_preferences ) as f: fo

Re: [Tutor] try and file existence

2015-08-15 Thread Cameron Simpson
On 15Aug2015 15:20, Clayton Kirkwood wrote: Behalf Of Laura Creighton [..] To: boB Stepp In a message of Sat, 15 Aug 2015 14:24:21 -0500, boB Stepp writes: >I understand your points, but wonder then what is the intended use for >os.path.exists()? That is, in what types of circumstances would

Re: [Tutor] variable existence q

2015-08-15 Thread Emile van Sebille
On 8/15/2015 3:38 PM, Clayton Kirkwood wrote: top_directory = "/users/Clayton/Pictures" target_directory = top_directory #directory we are checking filetypes = ('jpg', 'png', 'avi', 'mp4', 'mov', 'bmp') imports... def override_defaults(): with open( user_preferences ) as f: f

Re: [Tutor] variable existence q

2015-08-15 Thread Clayton Kirkwood
top_directory = "/users/Clayton/Pictures" target_directory = top_directory #directory we are checking filetypes = ('jpg', 'png', 'avi', 'mp4', 'mov', 'bmp') imports... def override_defaults(): with open( user_preferences ) as f: for line in f.readline(): llist = line.

Re: [Tutor] try and file existence

2015-08-15 Thread Clayton Kirkwood
> -Original Message- > From: Tutor [mailto:tutor-bounces+crk=godblessthe...@python.org] On > Behalf Of Laura Creighton > Sent: Saturday, August 15, 2015 2:49 PM > To: boB Stepp > Cc: l...@openend.se; tutor > Subject: Re: [Tutor] try and file existence > > In a message of Sat, 15 Aug 20

Re: [Tutor] variable existence q

2015-08-15 Thread Emile van Sebille
On 8/15/2015 2:47 PM, Mark Lawrence wrote: On 15/08/2015 22:11, Peter Otten wrote: Clayton Kirkwood wrote: 10 top_directory = "/users/Clayton/Pictures" def override_defaults(): 56 return( top_directory, filetypes, target_directory ) 80 top_directory, filetypes, target_directory = ov

Re: [Tutor] try and file existence

2015-08-15 Thread Laura Creighton
In a message of Sat, 15 Aug 2015 14:24:21 -0500, boB Stepp writes: >I understand your points, but wonder then what is the intended use for >os.path.exists()? That is, in what types of circumstances would it be >both appropriate and safe to use? > >boB If you want to locate dangling symlinks, os.

Re: [Tutor] variable existence q

2015-08-15 Thread Mark Lawrence
On 15/08/2015 22:11, Peter Otten wrote: Clayton Kirkwood wrote: 10 top_directory = "/users/Clayton/Pictures" def override_defaults(): 56 return( top_directory, filetypes, target_directory ) 80 top_directory, filetypes, target_directory = override_defaults() File "C:/Users/Clayto

Re: [Tutor] variable existence q

2015-08-15 Thread Peter Otten
Clayton Kirkwood wrote: > 10 top_directory = "/users/Clayton/Pictures" > > def override_defaults(): > 56 return( top_directory, filetypes, target_directory ) > > 80 top_directory, filetypes, target_directory = override_defaults() > > > File "C:/Users/Clayton/python/find picture

[Tutor] variable existence q

2015-08-15 Thread Clayton Kirkwood
10 top_directory = "/users/Clayton/Pictures" def override_defaults(): 56 return( top_directory, filetypes, target_directory ) 80 top_directory, filetypes, target_directory = override_defaults() File "C:/Users/Clayton/python/find picture duplicates/find picture duplicates", line 8

Re: [Tutor] try and file existence

2015-08-15 Thread boB Stepp
On Fri, Aug 14, 2015 at 10:39 PM, Steven D'Aprano wrote: > > On Fri, Aug 14, 2015 at 06:28:09PM -0700, Clayton Kirkwood wrote: > > what is the best way to find out if a file exists? > > Try to open it and see what happens. If the open() succeeds, then the > file exists and can be read. If it fail

Re: [Tutor] cannot get a label message to display immediately

2015-08-15 Thread Bill Allen
> > > On Sat, Aug 15, 2015 Bill Allen wrote: > > Yes, I see. I will start working on reorganizing the code with that in > mind. One other thing that I have found that is quite interesting is that > with my current code the use of after() works as expect with the message to > the user showing up i

Re: [Tutor] cannot get a label message to display immediately

2015-08-15 Thread Bill Allen
On Sat, Aug 15, 2015 at 2:21 AM, Alan Gauld wrote: That works for getting the message printed but it still leaves > > the problem that your UI locks up during the long process. > If its only for a couple of seconds it might be a mild hiccup > but if your processing took, say 5s or longer, the user

Re: [Tutor] try and file existence

2015-08-15 Thread Mark Lawrence
On 15/08/2015 04:39, Steven D'Aprano wrote: On Fri, Aug 14, 2015 at 06:28:09PM -0700, Clayton Kirkwood wrote: try: fp = open( user_preferences ) except( PermissionError ): else: with open(user_preferences ) as f: try: fp = open(user_preferences) except (IOError, OSError) as e:

Re: [Tutor] cannot get a label message to display immediately

2015-08-15 Thread Alan Gauld
On 15/08/15 06:44, Bill Allen wrote: In my case, as simple as this: def processing(*args): #my initial button click calls this info.set('PROCESSING, PLEASE WAIT...') #the label message I was root.after(1000, process_part) #the long running data process That works for getting th