Comments on: Learn Python Control Flow and Loops to Write and Tune Shell Scripts – Part 2 https://www.tecmint.com/learn-python-control-flow-and-loops/ Tecmint - Linux Howtos, Tutorials, Guides, News, Tips and Tricks. Thu, 02 Mar 2023 05:43:33 +0000 hourly 1 By: steve https://www.tecmint.com/learn-python-control-flow-and-loops/comment-page-1/#comment-857545 Thu, 05 Jan 2017 00:22:08 +0000 http://www.tecmint.com/?p=20813#comment-857545 Gabriel,

Don’t get why this script isn’t working, even after correcting for indentation and adding utf-8 it only runs under IDE’s.

At the console I still get…..

./uname.py: line 1: #!/usr/bin/python: No such file or directory

I only code in 2.7 hence the change or omission of line one. I Chmod it and that is the correct path to python2.7.
Yet this is the only python file run at the console that complains like this……….?

]]>
By: Gabriel A. Cánepa https://www.tecmint.com/learn-python-control-flow-and-loops/comment-page-1/#comment-804528 Thu, 04 Aug 2016 13:01:37 +0000 http://www.tecmint.com/?p=20813#comment-804528 In reply to Paul Campbell.

@Paul,
Thanks for bringing this to our attention. I must confess I never thought I had to state explicitly this would work on Linux only, but we will add that notice as per your suggestion.
@Ravi,
Please add a small note to clarify. As for the indentation, perhaps we will need a different WP plugin. Any ideas?

]]>
By: Paul Campbell https://www.tecmint.com/learn-python-control-flow-and-loops/comment-page-1/#comment-804422 Thu, 04 Aug 2016 05:10:53 +0000 http://www.tecmint.com/?p=20813#comment-804422 The web version does not include indentation where required by python syntax. I added the indentation and got past those errors and then got
the following:

SyntaxError: Non-ASCII character ‘\xc3’ in file uname.py on line 1, but no encoding declared; see http://python.org/dev/peps/pep-0263/ for details

Also it will not run on windows because os.uname not available except on linux.

I got around these errors by using pythonanywhere.com on the web. It ran and was neat but I would think some one at tecmint could help with
the indentation problem and also specify it will not work on Windows.

]]>
By: Gabriel A. Cánepa https://www.tecmint.com/learn-python-control-flow-and-loops/comment-page-1/#comment-804230 Wed, 03 Aug 2016 11:57:36 +0000 http://www.tecmint.com/?p=20813#comment-804230 In reply to big joe.

@big joe,
It’s possible that the web formatting has damaged the indentation a little. But I can assure you that the program works, as you can see in the screenshots.

]]>
By: big joe https://www.tecmint.com/learn-python-control-flow-and-loops/comment-page-1/#comment-804010 Tue, 02 Aug 2016 14:43:16 +0000 http://www.tecmint.com/?p=20813#comment-804010 Program will not run as shown due to no indentation starting with ‘if len(item) < len(headers[index]):'.

]]>