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 2057
Sylvain Thenault <sy************ **@nospam.logil ab.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.logil ab.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();
xml_set_character_data_handler( $parser, 'cdata' );
xml_set_element_handler( $parser, 'starthandler', 'endhandler' );
|
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 Development, I produced the test suite and the parser,
appearing in parallel posts.
--
Phlip
http://industrialxp.org/community/bin/view/Main/TestFirstUserInterfaces
|
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 with Sablotron 1.0) with
the following:
Warning: Sablotron error on line 1: XML parser error 4: not well-formed
(invalid token) in /...host...path.../page.php on line 28
FAILURE : XML parser error 4: not well-formed (invalid token) ; error
|
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 having issues using XmlTextWriter, saving it out to a file with UTF8
encoding, and seeing "dirty", or "human unreadable" characters show up
*right before* the XML declaration.
I need to have the XML declaration state "encoding = utf-8", but also...
| |
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 because I am doing
something wrong).
As it is said in http://xmlsoft.org/encoding.html the parser should
detect the encoding. So I tested it putting an utf-8 word in a file and
it does not detect it (it generates a wrong string). Example:
|
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") that, in turn, gets the
data from MySql server.
Locally testing it on my PC (Windows XP SP2, FYI) it works and no
errors appear. However, when I upload it to the webserver (Windows 2003
Web Edit. Server) I get the a parser error on the dataset...
|
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 characters in the underlying stream.
2. How do I make sure that the encoding of my created xmldocument or
xmlwriter is in utf-8?
Thanks!
/mortb
|
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):
PERL5LIB=/Users/Ric/Library/Perl/
ls
XML-Parser-2.34/ XML-Parser-2.34.tar
|
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
| |
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |