Re: [Tutor] Test discovery not locating module to test

2015-08-20 Thread Peter Otten
boB Stepp wrote: > W7 64-bit. Py 3.4.3 > > unittest result: > > E:\Projects\mcm>python -m unittest > E > == > ERROR: test.db.test_mcm_db_mgr (unittest.loader.ModuleImportFailure) > --

[Tutor] Request for help with os.walk() combining os.path.ismount() in Linux

2015-08-20 Thread Srihari Vijayaraghavan
Hello Folks, Please consider the following 2 scripts: 1. os_path_ismount.py: import os import sys out = sys.stdout.write out("%s\n" % os.path.ismount(sys.argv[1])) 2. os_walk.py: import sys import os out = sys.stdout.write for root, dirs, files in os.walk("/"): out("The dirs before removing mo

Re: [Tutor] Request for help with os.walk() combining os.path.ismount() in Linux

2015-08-20 Thread Alan Gauld
On 20/08/15 04:03, Srihari Vijayaraghavan wrote: out = sys.stdout.write for root, dirs, files in os.walk("/"): out("The dirs before removing mount points: %s\n" % dirs) for d in dirs: dname = os.path.join(root, d) if os.path.ismount(dname): dirs.remove(d) It

Re: [Tutor] Request for help with os.walk() combining os.path.ismount() in Linux

2015-08-20 Thread Laura Creighton
In a message of Thu, 20 Aug 2015 09:25:29 +0100, Alan Gauld writes: > >It always amazes me how often the same issues come up in >rapid succession. We must have had 4 or 5 of these types >of errors in the last couple of months, and other times >we go for 6 months or more without it being raised! :-)

Re: [Tutor] Request for help with os.walk() combining os.path.ismount() in Linux

2015-08-20 Thread Peter Otten
Laura Creighton wrote: > In a message of Thu, 20 Aug 2015 09:25:29 +0100, Alan Gauld writes: >> >>It always amazes me how often the same issues come up in >>rapid succession. We must have had 4 or 5 of these types >>of errors in the last couple of months, and other times >>we go for 6 months or mo

Re: [Tutor] Test discovery not locating module to test

2015-08-20 Thread boB Stepp
On Thu, Aug 20, 2015 at 2:37 AM, Peter Otten <__pete...@web.de> wrote: > Assuming E:/Projects/mcm/src is in the PYTHONPATH mcm_db_mgr.py (what an > alphabet soup!)... Written out in full, this would be montessori_classroom_manager_database_manager.py Hmm. Perhaps just db_manager.py? > ...is p

[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] iteration help

2015-08-20 Thread Joel Goldstick
On Thu, Aug 20, 2015 at 9:27 AM, richard kappler wrote: > 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 sc

Re: [Tutor] About using list in a function

2015-08-20 Thread Mark Lawrence
On 19/08/2015 18:25, Alan Gauld wrote: On 19/08/15 17:09, Michelle Meiduo Wu wrote: Hi there, I'm trying to use List in a function. But it doesn't work. Here are sample code not work: ---def getResult():ls = []ls= ls.append(100)ls= ls.append(200)

Re: [Tutor] Test discovery not locating module to test

2015-08-20 Thread Peter Otten
boB Stepp wrote: > On Thu, Aug 20, 2015 at 2:37 AM, Peter Otten <__pete...@web.de> wrote: > >> Assuming E:/Projects/mcm/src is in the PYTHONPATH mcm_db_mgr.py (what an >> alphabet soup!)... > > Written out in full, this would be > > montessori_classroom_manager_database_manager.py > Hmm. Perh

[Tutor] problem with code

2015-08-20 Thread Nathan Clark
I have written a basic program out of python and it is not functioning, please could you proof read my code and tell me how to fix it.It is in python 3.3 time=int(input("How long on average do you spend on the computer per day?") (print("that seems reasonable")) if time<=2 else print ("get a life"

Re: [Tutor] Request for help with os.walk() combining os.path.ismount() in Linux

2015-08-20 Thread Srihari Vijayaraghavan
On 20 August 2015 at 18:25, Alan Gauld wrote: > On 20/08/15 04:03, Srihari Vijayaraghavan wrote: > >> out = sys.stdout.write >> for root, dirs, files in os.walk("/"): >> out("The dirs before removing mount points: %s\n" % dirs) >> for d in dirs: >> dname = os.path.join(root, d) >>

Re: [Tutor] Request for help with os.walk() combining os.path.ismount() in Linux

2015-08-20 Thread Srihari Vijayaraghavan
On 20 August 2015 at 18:51, Srihari Vijayaraghavan wrote: > On 20 August 2015 at 18:25, Alan Gauld wrote: >> On 20/08/15 04:03, Srihari Vijayaraghavan wrote: >> >>> out = sys.stdout.write >>> for root, dirs, files in os.walk("/"): >>> out("The dirs before removing mount points: %s\n" % dirs)

Re: [Tutor] problem with code

2015-08-20 Thread Emile van Sebille
On 8/20/2015 2:50 AM, Nathan Clark wrote: I have written a basic program out of python and it is not functioning, please could you proof read my code and tell me how to fix it.It is in python 3.3 time=int(input("How long on average do you spend on the computer per day?") (print("that seems reaso

Re: [Tutor] Request for help with os.walk() combining os.path.ismount() in Linux

2015-08-20 Thread Alan Gauld
On 20/08/15 09:51, Srihari Vijayaraghavan wrote: In general I agree, but this is what the os.walk() document states: "... When topdown is True, the caller can modify the dirnames list in-place (perhaps using del or slice assignment)..." That's true so far as the os.walk call goes. That is, alt

Re: [Tutor] problem with code

2015-08-20 Thread Alan Gauld
On 20/08/15 10:50, Nathan Clark wrote: I have written a basic program out of python and it is not functioning, please could you proof read my code and tell me how to fix it.It is in python 3.3 time=int(input("How long on average do you spend on the computer per day?") (print("that seems reasonab

Re: [Tutor] iteration help

2015-08-20 Thread Alan Gauld
On 20/08/15 14:27, richard kappler wrote: While for and if loops always seem to give me trouble. A picky point, but it is conceptually very important. 'while' and 'for' are loops - because the loop back and repeat code. 'if' is not a loop. It is a selector. It only executes its code once but

Re: [Tutor] iteration help

2015-08-20 Thread Mark Lawrence
On 20/08/2015 14:27, richard kappler wrote: 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

Re: [Tutor] problem with code

2015-08-20 Thread Aravind Jaya
time = input("How long on average do you spend on the computer per day?") if time <= 2: print "Message1" else: print "Message2" On Thu, Aug 20, 2015 at 3:20 PM, Nathan Clark <26110...@gmail.com> wrote: > I have written a basic program out of python and it is not functioning, > please c

[Tutor] problem with code (Alan Gauld)

2015-08-20 Thread Freddy
Hello, I am trying to make Hangman. But main part of the game i.e. comparing user input with secret word is not working properly. Can you have a look where am I going wrong? Thank you Attachment: Python code file. ___ Tutor maillist - Tutor@py

Re: [Tutor] problem with code

2015-08-20 Thread Alan Gauld
On 20/08/15 18:07, Alan Gauld wrote: (print("that seems reasonable")) if time<=2 else print ("get a life") There is an alternative way of writing what you want but it's not very commonly used: print("that seems reasonable" if time <=2 else "get a life") I just realized that the OP's versi

Re: [Tutor] problem with code (Alan Gauld)

2015-08-20 Thread Joel Goldstick
On Thu, Aug 20, 2015 at 2:12 PM, Freddy wrote: > Hello, > > I am trying to make Hangman. But main part of the game i.e. comparing user > input with secret word is not working properly. > > Can you have a look where am I going wrong? > > > Thank you > > Attachment: Python code file. > No attachment

[Tutor] Do not understand why test is running.

2015-08-20 Thread boB Stepp
I adopted Peter's suggestions (I think!) and now have these two paths that are pertinent to my questions: Projects/mcm/mcm/db/manager.py # The module I am beginning to write tests for. Projects/mcm/test/db/test_manager.py# The file for my module tests. The test code currently is: import un

Re: [Tutor] Do not understand why test is running.

2015-08-20 Thread Steven D'Aprano
On Thu, Aug 20, 2015 at 09:01:50PM -0500, boB Stepp wrote: > import unittest > > # import modules to be tested: > import mcm.db.manager > > class ManagerTestCase(unittest.TestCase): > def setUp(self): > # Insert setup code here... > pass > > def test_open_db(self): >

Re: [Tutor] Do not understand why test is running.

2015-08-20 Thread boB Stepp
On Thu, Aug 20, 2015 at 10:13 PM, Steven D'Aprano wrote: > On Thu, Aug 20, 2015 at 09:01:50PM -0500, boB Stepp wrote: > > >> import unittest >> >> # import modules to be tested: >> import mcm.db.manager >> >> class ManagerTestCase(unittest.TestCase): >> def setUp(self): >> # Insert set

Re: [Tutor] Do not understand why test is running.

2015-08-20 Thread Peter Otten
boB Stepp wrote: > On Thu, Aug 20, 2015 at 10:13 PM, Steven D'Aprano > wrote: >> On Thu, Aug 20, 2015 at 09:01:50PM -0500, boB Stepp wrote: >> >> >>> import unittest >>> >>> # import modules to be tested: >>> import mcm.db.manager >>> >>> class ManagerTestCase(unittest.TestCase): >>> def setU