[issue13525] Tutorial: Example of Source Code Encoding triggers error

2011-12-03 Thread Nicolas Goutte

New submission from Nicolas Goutte nicolas.gou...@extragroup.de:

Current Behaviour

The tutorial of Python 3.2.x has an example to set an encoding in a source 
file: http://docs.python.org/py3k/tutorial/interpreter.html#source-code-encoding

It explains to set the following line at the start of the source code:
# -*- coding: cp-1252 -*-

However when done exactly so, Python raises the following exception:
SyntaxError: encoding problem: with BOM

The problem seems to be that Python knows Windows codepage 1252 as windows-1252 
(its IANA charset name, see 
http://www.iana.org/assignments/charset-reg/windows-1252 ) or alternatively as 
cp1252 (without dash) but not as cp-1252 (with dash).

As this is an example in the tutorial is particularly problematic, as users 
might not understand how to do it correctly.

This is still the case in the tutorial of Python 3.3 alpha: 
http://docs.python.org/dev/tutorial/interpreter.html#source-code-encoding


Expected Behaviour

The tutorial should give a correct example, for example with:
# -*- coding: windows-1252 -*-

Alternatively a totally other example as for Python 2.7 would be nice too: 
http://docs.python.org/tutorial/interpreter.html#source-code-encoding


Notes:
I have tested this with following Python implementations:
- Python 3.2.1 (openSUSE 12.1) on Linux
- Python 3.2.2 on Windows 7 SP1 64 Bits
- Python 3.2.2 on MacOS 10.5.8
(Always on the command line; I have not tested in IDLE.)

--
assignee: docs@python
components: Documentation
files: cp_1252broken.py
messages: 148798
nosy: docs@python, nicolasg
priority: normal
severity: normal
status: open
title: Tutorial: Example of Source Code Encoding triggers error
versions: Python 3.2
Added file: http://bugs.python.org/file23840/cp_1252broken.py

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue13525
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13525] Tutorial: Example of Source Code Encoding triggers error

2011-12-03 Thread Nicolas Goutte

Changes by Nicolas Goutte nicolas.gou...@extragroup.de:


Added file: http://bugs.python.org/file23841/windows_1252ok.py

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue13525
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue6723] csv.writer: example does not work

2009-08-18 Thread Nicolas Goutte

New submission from Nicolas Goutte nicolas.gou...@extragroup.de:

In the documentation for csv.writer, the example
spamWriter = csv.writer(open('eggs.csv', 'w'), delimiter=' ',
quotechar='|', quoting=QUOTE_MINIMAL)
does not work, as Python complains about SyntaxError: invalid syntax,
as QUOTE_MINIMAL is not a global identifier.

By replacing QUOTE_MINIMAL by csv.QUOTE_MINIMAL there is no syntax error
anymore.

I have discovered the issue with python 2.6.2. All online documentation
version (2.6, 2.7, 3.1, 3.2) seem to have the same documentation (e.g.
http://docs.python.org/library/csv.html )

--
assignee: georg.brandl
components: Documentation
messages: 91682
nosy: georg.brandl, nicolasg
severity: normal
status: open
title: csv.writer: example does not work
versions: Python 2.6

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue6723
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue5751] Typo in documentation of print function parameters

2009-04-14 Thread Nicolas Goutte

New submission from Nicolas Goutte nicolas.gou...@extragroup.de:

In http://docs.python.org/library/functions.html#print the print function 
is documented to have a parameter named end with a default 'n'. However 
the default should be '\n' as documented in Python 3 ( 
http://docs.python.org/3.0/library/functions.html#print )

--
assignee: georg.brandl
components: Documentation
messages: 85962
nosy: georg.brandl, nicolasg
severity: normal
status: open
title: Typo in documentation of print function parameters
versions: Python 2.6

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue5751
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com