Hi there !
I've noticed the following problem with python >= 2.3 (actually 2.3.4 and
2.4):
syt@musca:test$ python
Python 2.3.4 (#2, Sep 24 2004, 08:39:09)
[GCC 3.3.4 (Debian 1:3.3.4-12)] on linux2
Type "help", "copyright", "credits" or "license" for more information. import parser parser.suite('# -*- coding: IBO-8859-1 -*-')
Traceback (most recent call last):
File "<stdin>", line 1, in ?
MemoryError parser.suite('# -*- coding: ISO-8859-1 -*-')
<parser.st object at 0xb7e5e060>
Shouldn't parser.suite just ignore the wrong encoding declaration, or at
least raise a more appropriate exception. IMHO the first solution
would be better, since that's the behaviour of the (C) python interpreter.
--
Sylvain Thénault LOGILAB, Paris (France). http://www.logilab.com http://www.logilab.fr http://www.logilab.org 2 2041
Sylvain Thenault <sy**************@nospam.logilab.fr> writes: Hi there ! I've noticed the following problem with python >= 2.3 (actually 2.3.4 and 2.4):
syt@musca:test$ python Python 2.3.4 (#2, Sep 24 2004, 08:39:09) [GCC 3.3.4 (Debian 1:3.3.4-12)] on linux2 Type "help", "copyright", "credits" or "license" for more information. import parser parser.suite('# -*- coding: IBO-8859-1 -*-') Traceback (most recent call last): File "<stdin>", line 1, in ? MemoryError parser.suite('# -*- coding: ISO-8859-1 -*-')
<parser.st object at 0xb7e5e060>
Shouldn't parser.suite just ignore the wrong encoding declaration, or at least raise a more appropriate exception. IMHO the first solution would be better, since that's the behaviour of the (C) python interpreter.
Ignore the wrong declaration? All Python's that I have (on windows,
at least) raise a SyntaxError:
File "x.py", line 1
SyntaxError: 'unknown encoding: IBO-8859-1'
See also: http://www.python.org/sf/979739
Thomas
On Tue, 18 Jan 2005 16:16:32 +0100, Thomas Heller wrote: Sylvain Thenault <sy**************@nospam.logilab.fr> writes:
Hi there ! I've noticed the following problem with python >= 2.3 (actually 2.3.4 and 2.4):
syt@musca:test$ python Python 2.3.4 (#2, Sep 24 2004, 08:39:09) [GCC 3.3.4 (Debian 1:3.3.4-12)] on linux2 Type "help", "copyright", "credits" or "license" for more information.> import parser > parser.suite('# -*- coding: IBO-8859-1 -*-') Traceback (most recent call last): File "<stdin>", line 1, in ? MemoryError> parser.suite('# -*- coding: ISO-8859-1 -*-') <parser.st object at 0xb7e5e060>
Shouldn't parser.suite just ignore the wrong encoding declaration, or at least raise a more appropriate exception. IMHO the first solution would be better, since that's the behaviour of the (C) python interpreter.
Ignore the wrong declaration? All Python's that I have (on windows, at least) raise a SyntaxError:
File "x.py", line 1 SyntaxError: 'unknown encoding: IBO-8859-1'
hum, right (with python >= 2.3 which is the first release using those
declaration...). I was sure to have checked this but I've obviously
missed something. Maybe the fact that being able to parse it anyway is
the solution I wish has driven me to write this ;) I would like this
behaviour so that pylint can check a module with a wrong encoding
declaration anyway. But at least, SyntaxError would be better than
MemoryError.
See also:
http://www.python.org/sf/979739
thanks
--
Sylvain Thénault LOGILAB, Paris (France). http://www.logilab.com http://www.logilab.fr http://www.logilab.org This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Rutger Claes |
last post by:
I'm having troubles getting the euro sign through an XML parser.
With the following test code:
<?php
$string = "<root><test>€</test></root>";
$parser = xml_parser_create();...
|
by: vadi |
last post by:
Can any one help me in finding the test suite (test C++ examples) for
testing the C++ parser.
|
by: Phlip |
last post by:
C++ newsgroupies:
I wrote a parser to solve math expressions like "3.0 ^(4 - 5)", or "3 / 8".
Below my sig is test.h, the file containing a tiny test framework. Using it
and Test-Driven...
|
by: Martin Plantec |
last post by:
Hello,
I have managed (with your help!) to make a working XSLT stylesheet; it
works fine locally (Windows Apache + PHP with Sablotron 1.0), but it
fails on the remote host (FreeBSD Apache + PHP...
|
by: H Lee |
last post by:
Hi,
I'm an XML newbie, and not sure if this is the appropriate newsgroup to post
my question, so feel free to suggest other newgroups where I should post
this message if this is the case.
I'm...
|
by: icoba |
last post by:
Hi,
I am parsing html documents using the html parser from libxml2, and if
the encoding is included in the document it works perfectly but if it
is not, I think it does not work well (probably...
|
by: filip.norrgard |
last post by:
Hi All!
I've been developing an ASP.Net 2.0 web application using the Visual
Studio 2005 tools. Currently datagrids on a page are filled with data
from a dataset (a .xsd file in the "project")...
|
by: mortb |
last post by:
1. How do I determine which encoding a xmldocument or xmlreader uses when
opening a document?
I'm not just talking about the <?xml encoding="utf-8"?attribute, but the
actual encoding of the...
|
by: UncleRic |
last post by:
Environment: Mac OS X (10.4.10) on MacBook Pro
I'm a Perl Neophyte. I've downloaded the XML::Parser module and am attempting to install it in my working directory (referenced via PERL5LIB env):
...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
| |