Re: [Tutor] Error

2016-10-04 Thread Ramanathan Muthaiah
>
> I began to learn Python and after saving a file gra.py tried to reopen it
> and got an error (in the Annex).
>
> What's the error on re-opening the file ?

Also, share what version of Python, OS and editor you are using.

FYI, this is a text only list, images of attachments will be filtered.

/Ram
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] python coding problem

2016-09-26 Thread Ramanathan Muthaiah
>
> This is my first time using this so I hope it works.
> I am trying to find out why this code doesnt work.
> Its simple.  I want to find out which number is bigger.
>

Welcome!


>
> I hope you can help and that I am using this python feature properly.
> Thanks.
> The function prints the first two print statements then nothing else
> happens.
>

Have you tried swapping the print and return statement in the
if-elif-elif-else loop ?

>
> def maximum(n1, n2):
>   print "the first number is" ,n1
>   print "the second number is", n2
>   if n1 > n2:
> return
> print n1 , "is the bigger number"
>   elif n1 < n2:
> return n2
> print n2
>   elif n1 == n2:
> print "they are equal"
>   else:
> print "Sorry, No response found"
> maximum(1,2)
>
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] (no subject)

2016-07-25 Thread Ramanathan Muthaiah
Hi Dilip,

This error has nothing to do with Python or it's versions.
OS does not have the support for these unicode characters. You need to fix
that.


> filename = "මේක තියෙන්නේ සිංහලෙන්.txt"
> Why can't I get Python to print the name out?
>
> filename =  "මේක තියෙන්නේ සිංහලෙන්.txt"
> Unsupported characters in input
>

--
regards
Ram
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


[Tutor] Howto display progress as cmd is being executed via subprocess ?

2016-06-13 Thread Ramanathan Muthaiah
Hello All,

Am aware of the module called 'progressbar' that can do this magic of
displaying progress as the cmd is executed.
In fact, I have a test code to show progress and tried, it works.



from progressbar import *
import time

def main():
progress = ProgressBar()
for num in progress(range(80)):
time.sleep(0.15)

if __name__ == '__main__':
main()

And, I have this piece of code that executes set of cmds stored in 'cmd'
variable.
This too works without any issues until now.

try:
 dlog = subprocess.check_output([cmd],
stderr=subprocess.STDOUT, shell=True)
except subprocess.CalledProcessError, e:
dlog = e.output

Question:

Am lost as to how to combine the progressbar and subprocess code snippets
to show the progress as the cmd is being executed.

Any ideas on how this can be done ?

--
regards
Ramanathan.M
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor