Re: [Tutor] Changing the interpreter prompt symbol from ">>>" to ???

2016-03-11 Thread boB Stepp
On Fri, Mar 11, 2016 at 10:08 PM, wolfrage8...@gmail.com
 wrote:
>  On a web based terminal via codeanywhere.com setting sys.ps1 =
> chr(16) results in no character being displayed. It is literally just
> a new line. So something to think about. I set it back to sys.ps1 =
> '>>>'

Thanks for the feedback.  I tried out your link, codeanywhere.com .  I
have to confess my experience was not a good one.  Firstly, the
environment supplied would not accept my space bar characters!  So I
could not type any import statements.  However, I did try:

print('\u25ba'), which did not require any spaces and received an
error stating that it would not accept values greater than hex ff.  So
it is pretty clear that following Cameron's suggestion is not (At
least on the surface.) doable in the codeanywhere environment.  Might
I suggest pythonanywhere?  All of this works fine with utf-8 there.

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


Re: [Tutor] Changing the interpreter prompt symbol from ">>>" to ???

2016-03-11 Thread boB Stepp
On Fri, Mar 11, 2016 at 11:02 PM, Cameron Simpson  wrote:
> On 11Mar2016 21:31, boB Stepp  wrote:
>>
>> I must be bored tonight.  I have to confess that when copying and
>> pasting from the interpreter into a plain text email, I often find it
>> cluttered to confusing by all the ">>>..." that can result from nested
>> quoting.  So I poked around on the Internet and found that I can
>> temporarily change the prompt symbol using sys.ps1.  My initial trials
>> are:
>>
>> Python 3.5.1 (v3.5.1:37a07cee5969, Dec  6 2015, 01:54:25) [MSC v.1900
>> 64 bit (AMD64)] on win32
>> Type "help", "copyright", "credits" or "license" for more information.
>
> import sys
> sys.ps1 = '=>'
>>
>> =>sys.ps1 = chr(26)
>> →sys.ps1 = chr(16)
>> ►
>>
>> I personally like the last of these.  My question is, will this show
>> up as a black, filled-in arrowhead pointing to the right on everyone's
>> email?  I have yet to delve into Unicode display issues, but I have
>> vague recollections that the old ASCII table values might not always
>> display the same thing from one person's display to another one's.  Is
>> this correct?
>
>
> For 16 and 26, yes. They are not printable characters; I'm surprised they
> render as visible symbols at all. Certainly other terminals are under no
> obligation to render them this way.
>
> When I run your code above I get empty appearing prompts as I would have
> expected - these are control characters and not printable.
>
> This leads me to ask: what is your environment? Mine is Mac OSX in an iTerm,
> which renders Unicode.

Win7-64bit, Py 3.5.1

[...]

>  0x25ba BLACK RIGHT-POINTING POINTER
>
> So it seems that your environment has chosen to transcribe your chr(26) and
> chr(16) into some glyphs for display, and matched those glyphs with suitable
> Unicode codepoints. (Well, "suitable" if you also see a right-arrow and a
> right pointing triangle; do you?)

I did with the non-printing control character, but not with '\u25ba' !
 So I had to go through some contortions after some research to get my
Win7 cmd.exe and PowerShell to display the desired prompt using
'\u25ba' as the character with utf-8 encoding.  My new
pythonstartup.py file (Which PYTHONSTARTUP now points to) follows:

#!/usr/bin/env python3

import os
import sys

os.system('chcp 65001')# cmd.exe and PowerShell require the code
page to be changed.
sys.ps1 = '\u25ba '  # I remembered to add the additional space.

Additionally, one must set the font for cmd.exe and PowerShell to
"Lucida Console" or the above will not work.

> So: I would not rely on your stuff being presented nicely if you use 16 and
> 26 because they are not printable to start with, and you just got lucky. If,
> OTOH, you figure out some nice glyphs and their Unicode points, then many
> environments will render them sensibly. Though, of course, not a pure ACII
> terminal - those are rare these days though.

So let's see if this copies and pastes into a plain text Gmail and is
visible to "many environments":

Python 3.5.1 (v3.5.1:37a07cee5969, Dec  6 2015, 01:54:25) [MSC v.1900
64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
Active code page: 65001
► print("Can everyone read the prompt?")
Can everyone read the prompt?
►

It looks good to me in Gmail.  Any issues?  Angry users of pure ASCII
terminals? ~(:>)

I still have not figured out how to make this change in IDLE.
Research will continue...

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


[Tutor] avoiding top-posting in GMail (was: Changing the interpreter prompt symbol from ">>>" to ???)

2016-03-11 Thread Cameron Simpson

On 12Mar2016 00:19, wolfrage8...@gmail.com  wrote:

Also before I get called out; sorry for the top post; I blame G-Mail's
Interface.


I once worked in a place where GMail was pretty much the standard mail tool 
(guess where that might be:-) We took GMail's cursor-at-the-top style to be a 
cue that you should start trimming quoted junk there, and insert your remarks, 
blank line delimited, under each remaining relevant untrimmed quoted material 
snippet.


Which leads to exactly what we all want here: inline posted replies with 
irrelevant stuff cleaned up for maximum contextual relevance.



And good luck finding a better option; perhaps detecting if Unicode is
supported on the system then we could use something such as Right
Facing Triangle.


 % locale
 LANG="en_GB.UTF-8"
 LC_COLLATE="C"
 LC_CTYPE="en_GB.UTF-8"
 LC_MESSAGES="en_GB.UTF-8"
 LC_MONETARY="en_GB.UTF-8"
 LC_NUMERIC="en_GB.UTF-8"
 LC_TIME="en_GB.UTF-8"
 LC_ALL=

I think my terminal might be Unicode friendly...

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


Re: [Tutor] Changing the interpreter prompt symbol from ">>>" to ???

2016-03-11 Thread wolfrage8...@gmail.com
Also before I get called out; sorry for the top post; I blame G-Mail's
Interface.

And good luck finding a better option; perhaps detecting if Unicode is
supported on the system then we could use something such as Right
Facing Triangle.
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Changing the interpreter prompt symbol from ">>>" to ???

2016-03-11 Thread Cameron Simpson

On 11Mar2016 21:31, boB Stepp  wrote:

I must be bored tonight.  I have to confess that when copying and
pasting from the interpreter into a plain text email, I often find it
cluttered to confusing by all the ">>>..." that can result from nested
quoting.  So I poked around on the Internet and found that I can
temporarily change the prompt symbol using sys.ps1.  My initial trials
are:

Python 3.5.1 (v3.5.1:37a07cee5969, Dec  6 2015, 01:54:25) [MSC v.1900
64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.

import sys
sys.ps1 = '=>'

=>sys.ps1 = chr(26)
→sys.ps1 = chr(16)
►

I personally like the last of these.  My question is, will this show
up as a black, filled-in arrowhead pointing to the right on everyone's
email?  I have yet to delve into Unicode display issues, but I have
vague recollections that the old ASCII table values might not always
display the same thing from one person's display to another one's.  Is
this correct?


For 16 and 26, yes. They are not printable characters; I'm surprised they 
render as visible symbols at all. Certainly other terminals are under no 
obligation to render them this way.


When I run your code above I get empty appearing prompts as I would have 
expected - these are control characters and not printable.


This leads me to ask: what is your environment? Mine is Mac OSX in an iTerm, 
which renders Unicode.


Interestingly, your _email_ showing your code is presented to me as 
right-pointing triangle for chr(16) and a little arrow for chr(26), so your 
environment has translated your cut/paste from your display into something that 
renders. Your email message, as received here, is in UTF-8.


Decoding that Unicode says your right-arrow is codepoint 0x2192 and your 
triangle is 0x25ba. Let's write a little program:


 #!/usr/bin/python3
 import sys
 import unicodedata
 s=sys.stdin.read()
 for c in s:
   try:
 uname = unicodedata.name(c)
   except ValueError as e:
 uname = "UNNAMED: %s" % (e,)
   print("0x%04x %s" % (ord(c), uname))

Echoing your text into it says, for the right arrow and the triangle 
respectively:


 0x2192 RIGHTWARDS ARROW
 0x25ba BLACK RIGHT-POINTING POINTER

So it seems that your environment has chosen to transcribe your chr(26) and 
chr(16) into some glyphs for display, and matched those glyphs with suitable 
Unicode codepoints. (Well, "suitable" if you also see a right-arrow and a right 
pointing triangle; do you?)


So: I would not rely on your stuff being presented nicely if you use 16 and 26 
because they are not printable to start with, and you just got lucky. If, OTOH, 
you figure out some nice glyphs and their Unicode points, then many 
environments will render them sensibly. Though, of course, not a pure ACII 
terminal - those are rare these days though.


Finally, I would also recommend that whatever prompt you use has a trailing 
space so that people can more easily separate it from the code.

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


Re: [Tutor] Changing the interpreter prompt symbol from ">>>" to ???

2016-03-11 Thread William Ray Wing

> On Mar 11, 2016, at 10:31 PM, boB Stepp  wrote:
> 
> I must be bored tonight.  I have to confess that when copying and
> pasting from the interpreter into a plain text email, I often find it
> cluttered to confusing by all the ">>>..." that can result from nested
> quoting.  So I poked around on the Internet and found that I can
> temporarily change the prompt symbol using sys.ps1.  My initial trials
> are:
> 
> Python 3.5.1 (v3.5.1:37a07cee5969, Dec  6 2015, 01:54:25) [MSC v.1900
> 64 bit (AMD64)] on win32
> Type "help", "copyright", "credits" or "license" for more information.
 import sys
 sys.ps1 = '=>'
> =>sys.ps1 = chr(26)
> →sys.ps1 = chr(16)
> ►
> 
> I personally like the last of these.  My question is, will this show
> up as a black, filled-in arrowhead pointing to the right on everyone's
> email?  

Can't answer for "everyone" but it certainly shows up that way in Apple Mail. 
And I agree, I rather like it too, and for the same reason: false 
interpretation of the standard prompt as nested quotes. 
-Bill

> I have yet to delve into Unicode display issues, but I have
> vague recollections that the old ASCII table values might not always
> display the same thing from one person's display to another one's.  Is
> this correct?
> 
> And a related question:  I often have the IDLE version of the Python
> shell open.  How can I make this sort of change for IDLE?  I have done
> some Googling on this as well, but haven't found the right search
> query yet.  I also poked into some of the idlelib files, but so far
> the only ">>>" I've found have been in specialized displays like IDLE
> debug.
> 
> TIA!
> 
> -- 
> boB
> ___
> Tutor maillist  -  Tutor@python.org
> To unsubscribe or change subscription options:
> https://mail.python.org/mailman/listinfo/tutor
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Changing the interpreter prompt symbol from ">>>" to ???

2016-03-11 Thread wolfrage8...@gmail.com
 I am not surprised since you have set it to a usually non printable
character of ascii the data link escape. Perhaps you would have better
luck with the extended ascii characters; but not much in there for
arrows. I would probably go with chr(175) but that did not display
correctly in the web based terminal either; because it looked like an
underline at the top of the character block.

On Fri, Mar 11, 2016 at 10:59 PM, boB Stepp  wrote:
> On Fri, Mar 11, 2016 at 9:31 PM, boB Stepp  wrote:
>
>> Python 3.5.1 (v3.5.1:37a07cee5969, Dec  6 2015, 01:54:25) [MSC v.1900
>> 64 bit (AMD64)] on win32
>> Type "help", "copyright", "credits" or "license" for more information.
> import sys
> sys.ps1 = '=>'
>> =>sys.ps1 = chr(26)
>> →sys.ps1 = chr(16)
>> ►
>>
>> I personally like the last of these.  My question is, will this show
>> up as a black, filled-in arrowhead pointing to the right on everyone's
>> email?  I have yet to delve into Unicode display issues, but I have
>> vague recollections that the old ASCII table values might not always
>> display the same thing from one person's display to another one's.  Is
>> this correct?
>
> There looks to be the potential for problems.  I tried:
>
> ►for i in range(256):
> ... try:
> ... print(str(i) + ': ' + chr(i))
> ... except UnicodeEncodeError as e:
> ... print(e)
>
> which gave in some sections:
>
> 126: ~
> 127:
> 'charmap' codec can't encode character '\x80' in position 5: character
> maps to 
> 'charmap' codec can't encode character '\x81' in position 5: character
> maps to 
>
> So how reliable is the chr(16) character on people's displays?
>
> boB
> ___
> Tutor maillist  -  Tutor@python.org
> To unsubscribe or change subscription options:
> https://mail.python.org/mailman/listinfo/tutor
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Changing the interpreter prompt symbol from ">>>" to ???

2016-03-11 Thread wolfrage8...@gmail.com
 On a web based terminal via codeanywhere.com setting sys.ps1 =
chr(16) results in no character being displayed. It is literally just
a new line. So something to think about. I set it back to sys.ps1 =
'>>>'

On Fri, Mar 11, 2016 at 10:59 PM, boB Stepp  wrote:
> On Fri, Mar 11, 2016 at 9:31 PM, boB Stepp  wrote:
>
>> Python 3.5.1 (v3.5.1:37a07cee5969, Dec  6 2015, 01:54:25) [MSC v.1900
>> 64 bit (AMD64)] on win32
>> Type "help", "copyright", "credits" or "license" for more information.
> import sys
> sys.ps1 = '=>'
>> =>sys.ps1 = chr(26)
>> →sys.ps1 = chr(16)
>> ►
>>
>> I personally like the last of these.  My question is, will this show
>> up as a black, filled-in arrowhead pointing to the right on everyone's
>> email?  I have yet to delve into Unicode display issues, but I have
>> vague recollections that the old ASCII table values might not always
>> display the same thing from one person's display to another one's.  Is
>> this correct?
>
> There looks to be the potential for problems.  I tried:
>
> ►for i in range(256):
> ... try:
> ... print(str(i) + ': ' + chr(i))
> ... except UnicodeEncodeError as e:
> ... print(e)
>
> which gave in some sections:
>
> 126: ~
> 127:
> 'charmap' codec can't encode character '\x80' in position 5: character
> maps to 
> 'charmap' codec can't encode character '\x81' in position 5: character
> maps to 
>
> So how reliable is the chr(16) character on people's displays?
>
> boB
> ___
> Tutor maillist  -  Tutor@python.org
> To unsubscribe or change subscription options:
> https://mail.python.org/mailman/listinfo/tutor
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Changing the interpreter prompt symbol from ">>>" to ???

2016-03-11 Thread boB Stepp
On Fri, Mar 11, 2016 at 9:31 PM, boB Stepp  wrote:

> Python 3.5.1 (v3.5.1:37a07cee5969, Dec  6 2015, 01:54:25) [MSC v.1900
> 64 bit (AMD64)] on win32
> Type "help", "copyright", "credits" or "license" for more information.
 import sys
 sys.ps1 = '=>'
> =>sys.ps1 = chr(26)
> →sys.ps1 = chr(16)
> ►
>
> I personally like the last of these.  My question is, will this show
> up as a black, filled-in arrowhead pointing to the right on everyone's
> email?  I have yet to delve into Unicode display issues, but I have
> vague recollections that the old ASCII table values might not always
> display the same thing from one person's display to another one's.  Is
> this correct?

There looks to be the potential for problems.  I tried:

►for i in range(256):
... try:
... print(str(i) + ': ' + chr(i))
... except UnicodeEncodeError as e:
... print(e)

which gave in some sections:

126: ~
127: 
'charmap' codec can't encode character '\x80' in position 5: character
maps to 
'charmap' codec can't encode character '\x81' in position 5: character
maps to 

So how reliable is the chr(16) character on people's displays?

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


[Tutor] Changing the interpreter prompt symbol from ">>>" to ???

2016-03-11 Thread boB Stepp
I must be bored tonight.  I have to confess that when copying and
pasting from the interpreter into a plain text email, I often find it
cluttered to confusing by all the ">>>..." that can result from nested
quoting.  So I poked around on the Internet and found that I can
temporarily change the prompt symbol using sys.ps1.  My initial trials
are:

Python 3.5.1 (v3.5.1:37a07cee5969, Dec  6 2015, 01:54:25) [MSC v.1900
64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> sys.ps1 = '=>'
=>sys.ps1 = chr(26)
→sys.ps1 = chr(16)
►

I personally like the last of these.  My question is, will this show
up as a black, filled-in arrowhead pointing to the right on everyone's
email?  I have yet to delve into Unicode display issues, but I have
vague recollections that the old ASCII table values might not always
display the same thing from one person's display to another one's.  Is
this correct?

And a related question:  I often have the IDLE version of the Python
shell open.  How can I make this sort of change for IDLE?  I have done
some Googling on this as well, but haven't found the right search
query yet.  I also poked into some of the idlelib files, but so far
the only ">>>" I've found have been in specialized displays like IDLE
debug.

TIA!

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


Re: [Tutor] Program Arcade Games Help

2016-03-11 Thread Alan Gauld
On 11/03/16 15:11, Ethan Batterman wrote:
> I am really struggling with Lab 9: Functions pt 3 and 4 of program arcade 
> games.

We have no idea what you are talking about.
I assume you are studying some kind of course or book. But which one?
What is Lab 9? What are functions pt 3 and 4?
What is program arcade games?

Without some context we can't start to answer your questions.

Also, when you say "completely lost" what exactly do you mean?
Do you understand the assignment? Or do you not know where to
start? Or have you started and it's not working?

The more specific information you can give us the more
meaningful our replies can be.

-- 
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos


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


Re: [Tutor] Installing package from zip fil

2016-03-11 Thread Alan Gauld
On 11/03/16 15:14, Abdul Barik wrote:
> I am using python 3.3.3 on windows 8. I downloaded the PyPDF2 package. And
> I installed it by running the setup.py file. But when I run the my program
> python terminal shows that there is no such package.  Plz help me.

Thanks, you've already given us a lot of useful information. But,
can you tell us exactly how you ran setup.py?

What directory were you in?
What prompt were you using (CMD or Python?)
Did you specify any options?
Did you get any status messages or errors reported?

-- 
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos


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


[Tutor] Program Arcade Games Help

2016-03-11 Thread Ethan Batterman
I am really struggling with Lab 9: Functions pt 3 and 4 of program arcade 
games. Any help or guidance would be greatly appreciated. I am completely lost. 
Thank you in advance!


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


[Tutor] Installing package from zip fil

2016-03-11 Thread Abdul Barik
I am using python 3.3.3 on windows 8. I downloaded the PyPDF2 package. And
I installed it by running the setup.py file. But when I run the my program
python terminal shows that there is no such package.  Plz help me.
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor