Join Club ShowMeDo to Learn Python!

This series is a part of Club ShowMeDo. Click to learn why you should join our club with a simple monthly subscription.

  • We teach Python and all the cool modules
  • Topics include beginner Python, GUIs, Web and Desktop Apps
  • Long, specially crafted video tutorials just for you
  • Club video tutorials extend our normal Free content
  • Save your time - we've done the research for you
  • Keep your skills up-to-date
  • Learn at your own pace, everything you need is shown to you
  • Over 12 hours of archived material are waiting for you in the club

Name: [002] Ian Ozsvald
Member: 105 months
Authored: 181 videos
Description: I am the co-founder of ShowMeDo (see http://showmedo.com/about), author of `The Screencasting Handbook <http://thescreencastinghandbook.com>`_ and the founder of the professional screencast production company `ProCasts <http://procasts.co.uk>`_: .. image:: http://procasts.co.uk/media/procasts_sma ...

Exception handling and Unit-testing with justNumbers [ID:251] (10/17)

in series: Python 101 - easygui and csv

(Showmedo is undergoing major changes. To report any problems viewing the videos please email us and include browser and OS specifics. Cheers - Kyran.)

Now we write unit-tests for our code using the powerful Test-Driven Development (TDD) approach. Using TDD we expand the new justNumbers function which means we need to look at exception handling to sensibly handle a ValueError exception.

In this episode you will learn about exception handling and you'll see why you should use the TDD approach to developing your own code.

Created May 2007, running time 5 minutes

Got any questions?

Get answers in the ShowMeDo Learners Google Group.

Video statistics:

  • Video's rank shown in the most popular listing
  • Video plays: 269 (since July 30th)
  • Plays in last week: 0
  • Published: 87 months ago

Thank-yous, questions and comments

If this video tutorial was helpful please take some time to say thank-you to the authors for their hard work. Feel free to ask questions. Let the author know why their video tutorial was useful - what are you learning about? Did the video tutorial save you time? Would you like to see more?

You may also want to see our ShowMeDo Google Group to speak to our active users and authors.

Your email address will not be published.

Show some quick comments >>








All comments excluding tick-boxed quick-comments

Exception handling and Unit-testing with justNumbers (10/17)

3:40 Suggested pause point


I like the video and found the content very useful, but I would like the source code for this to be added to the video page especially since the video says it is there and it is (still) not.


Development through testing from the beginning!! I love it.

The source code tab is missing but I think it would be better to make everyone hand code it all anyway. That way they can pull their hair trying to figure out why it's not working only to see they forgot to capitalize an S...like I did.....ooppsss!!


Hi Ian,

The Source Code Tab is still missing from this page.


Excellent advanced topic. The page is missing the source code (I did get it off the video and it worked fine.)


Everything is fixed now, thanks again Ian.


Hi joshmo23 - I emailed you last week but haven't heard a reply. I hope that everything is ok now?

Regards,

Ian.


Hey Ian, I like the videos and have been able to follow them quite well until this video. When I go to run 'nosetests' against the code from this video I get an 'AssertionError' in the testCSVReader file.


Hi Hobart. Re. your question - yes, Python will give an error. What you're saying is "here's a bit of code (the body of the Try section) which I'd like you to try to run, if it works then fine, if it causes an error then drop into the Except section and run my error handler code".

General background:

http://en.wikipedia.org/wiki/Exceptions

and particularly for Python:

http://docs.python.org/tut/node10.html

along with the ever-useful Dive Into Python:

http://www.diveintopython.org/file_handling/index.html

We tend to use 'try' when we expect errors to occur (e.g. when dealing with files which might not exist or network connections which might disappear) and we handle their 'exceptional' behaviour in a planned way.

Let me know if you want more detail?

Ian.


Can you explain what a Try/Except is meant to do? If I try to use a list of numbers in my application, for example, that has some alphabetic item, python will give me an error, correct?

I'm a little lost about the whole concept of try.


Yes - it is clear that I ought to be using larger fonts, I've tried this in my latest Python video - Adding Python to Windows PATH:

http://showmedo.com/videos/video?name=960000&fromSeriesID=96

Thanks for the reminder.

I didn't put in src code on this video (or some others) as it just builds a bit on the previous video...I can add it if necessary?

Ian.


Cool concept to use a external function to produce an error... i begin (slow) to understand the concept.

Suggestion:

Can you make the souce-code font in the WING IDE larger ? it is hard to read for me.

Source-code tab: There is no source-code tab visible for this video... :-(


Showmedo is a peer-produced video-tutorials and screencasts site for free and open-source software (FOSS)- with the exception of some club videos, the large majority are free to watch and download.

how to help » about » faq »

Educating the Open-source Community With Showmedo

Although as important as the software it supports, education and documentation are relatively neglected in the Open-source world. Coders love to code, and explaining how best to use or improve the software tends to be deferred or even sidelined.

At Showmedo we believe the community can play a vital role here and also say thanks for the tools and software that make our lives easier. If you have a piece of software you love or a programming langugage you are enthusiastic about, why not make a screencast showing others how to use it? All the stuff you wish you'd been told, the tips, tricks, insights that would have saved you time and frustration.

Screencasting is easier than you think, and we're happy to help you. You can emailus for advice or just use some of the how-to screencasts on the site. This screencasting learning-pathis a good place to start.

Kudos and Thanks for Ian

Content

Feedback

Showmedo's development is fairly rapid and bugs will inevitably creep in. If you have any problems please drop us a line using the contact address below. Likewise, any suggestions for improvements to the site are gratefully received.

feedback@showmedo.com