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: 109 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 ...

Python at the command line [ID:139] (5/10)

in series: Python Development on XP

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

The easiest way to run scripts is to run them from the command line. Assuming you've set-up your system's Path variable (I show you how) you can run your scripts and execute lines of code directly (using the -c switch) from the command line.

Having configured Python we then go on to run a script at the command line and edit the previous episode's hello.py using Notepad, demonstrating Notepad's deficiencies as an editor(!).

I also set a simple task for you - write a script to list the contents of the directory (replicating the normal 'dir' command at the DOS prompt). You'll find some help here.

To talk to your fellow Pythonistas you should join the ShowMeDo Learners Google Group.

Got any questions?

Get answers in the ShowMeDo Learners Google Group.

Video statistics:

  • Video's rank shown in the most popular listing
  • Video plays: 267 (since July 30th)
  • Plays in last week: 0
  • Published: Sometime before 1st March 2007 (in other words - we don't remember!)

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

Good (it would be interesting to see the os module working, being so important...). More interesting for the use of the command line in Windows is a course of the usual scripts (like setup.py for the different downloads) and the "-" commands that are more of use. The hello example give a interesting idea with the -c but it is not clear what the -c means (I know now because other course).

Evaristo


i've been reading about python for two days... so far no one has mentioned a ruby or perl like -c switch for checking syntax... what is the python point of view on this?


why can't i download "Python at the command line"


good lesson, showing how to add python to windows command line is very helpful.


Awesome stuff! thanks! :D


great introduction to different ways of executing scriptes and places where to look for info etc.


Hi Eldaria, thanks for the comment. Sorry about the 'discussions' - they have moved (and I need to update the links) to a Google Group:

http://groups.google.com/group/showmedo-learners

PyQT is a possibility, we've had requests for both that and pyGTK.

Cheers,

Ian.


Nice tutorial, I just joined your site since I'm trying to learn Python.

I used to fiddle in VB on Windows, but since my move to linux I was looking for a new language, and I like Python, so your site is resourceful.

Hopefully in the future perhaps you can do some PyQT Tutorials also?

I looked for the discussion on this video on the groups but a search did not come up with any related to this discussion so apologies for puttting my response here, Another suggestion on that would be to have a link on each video to the corresponding discussion?

I looked on the documentation, I guess it is possible to make it 2 lines, but the output is crude.

With 3 lines it looks better.

Although it depends if you count the import line as part of the script.


Hi marlow. Ag, yes, that's a bad link to the forum - we replaced that with the active Google Group a while ago:

http://groups.google.com/group/showmedo

I shall have to update my links.

Re. the exercise - yes, this one was deliberately vague as it was just to get you thinking. In my latest series on building a wxPython Image Viewer:

http://showmedo.com/videos/series?name=To3wW0reK

I deliberately give exercises (they'll be published soon) with fully-worked answers in the following episode. I've decided that this latter format is better for learning, I'll be curious to hear your feedback (expect the exercises from the start of March).

Ian.


Nice series so far. Providing an exercise was a nice idea, but the exercise was too vague for me. I created a 2 line python file which when exec'd does list the dir files, but I didn't pass via argv or produce a formatted dir list. Not too important I'm sure--the idea was to look up some references and actually do something I'm guessing.

The link at left: "Come join me in the forum for questions and more assignments..." seems to the wrong specific place : I went there to try & find what others did for the exercise (I couldn't find the forums from the menu bar "resources" tab...), but the forum entry was to the somewhat old closed forum msg/discussion: "Python Newbies on XP [paid-for series]" between Ian and an early user of showmedo. I eventually backed out into the general forum area.


Hi Macca, great, glad to hear that you enjoyed the exercises!

I was pleasantly surprised to find that they were so popular so I made sure I added lots more to the second pay-to-own series (Python 101: easygui and csv).

Cheers!

Ian.


Thanks Ian, I thoroughly enjoyed the video especially the homework, which was great.

My first micro project complete in 2 lines as requested!

However, I have to admit I did struggle with the simplistic task of printing to output from the script.

Easy in reflection but I was delving to deep to start and missing the obvious.

I feel like I have learnt loads already.

Please set more of these little tasks as they help develop the focus and mindset required to develop.

Brilliant thanks.


dgd - re. your previous comment on 'comments on the timeline'. Sounds like a neat idea but quite complicated for us to implement. Something for us to think about though.

Cheers,

Ian.


Good idea and this is something that I want to cover in a future series. I have made a note, thanks for the suggestion :-)

Ian.


Instead of the -c how about an example of passing params to python via the windows command... for example a script that read a.txt and changes all X to Y and then saves the new document b.txt.

The commands to do so passed via python on the CL in windows prompt.


It would be nice if we can add comments to specific parts in the timeline of the video as we are watching it...


That works perfectly - thanks for the hint. I have just started Python and have read through several tutorials and online videos and nothing comes close to the realistic programming videos like showmedo - great job!


Hi Ryan. Well, this exercise is very straightforward so I need to avoid writing the answer in just two lines! You'll find all the documentation you need here:

http://docs.python.org/lib/os-file-dir.html

Look for 'listdir' and 'getcwd' and everything will become clear. If you don't know about how to import a file, you need 'import os' as the first line of your program (watch later episodes on the PyDev tutorials for more information on the import command).

Ian.


Can you give help with the os tutorial? Which command should I use? Great video!


Hi again Vincent, cool, glad that you found it all so easy to follow :-)

I remembered that this was all tricky when I started so it made sense to include this episode, especially for things like setting up the system paths.

Ian.


This covered the kind of thing that can give you fits when you first get started trying to run scripts from the command line. Love the step by step instructions. You haven't lost me yet, and I can get lost pretty easily. Thanks.


good job again, Ian. I think the best part of this session is to introduce newbies to the python lib. The exercise is so simple that it gives newbies like me an imstant feeling about complishment and helps us overcome the fear of python documents! A perfect ice-breaker for python lib doc.

I see that you are taking a systematic approach and completely shows every details. That is great to make sure that no one is left behind. Sorry for my comments on last episode of "command line usage". I was jumping ahead...


Good job Ian. I agree that in general that we'll all be using some sort of IDE or more full featured editor but I really liked the "get started quick" approach.

I really enjoyed the *basic* assignment. The information was all right at our fingertips after the video so really it was just a great way to write a simple script that gave us a feel for Python.

I even feel a bit more comfortable after writing it. I've been playing around with Python and a couple of web frameworks (TurboGears &amp; Django) but this did more for me as far as the feel of Python. I'm looking for more assignments as soon as I'm able.

Thanks,

Chris


Hi Jack, thanks for the comment. Glad you liked the exercise, the aim there was to give you 'just enough' to get you thinking...of course the forum is there for anyone who needs a bit of guidance.

It is great to hear that you feel this set gets you going in the right direction...that's exaclty the reason we are doing this!

Cheers,

Ian.


Thanks Ian

Over all I like this Video.

The exercise was useful. It took me three line if you include the import module.

I had to do some reading but the information was at the link I needed. I little trial and error and in no time exercise was complete.

Being reintroduced to programming after 7 years. Python is the way to go. ShowMeDo has help me get up and running with Python in days instead of weeks or months.


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