Bug 481540 - pydot crashes with character with accent
pydot crashes with character with accent
Product: Fedora
Classification: Fedora
Component: pydot (Show other bugs)
All Linux
low Severity medium
: ---
: ---
Assigned To: Tom "spot" Callaway
Fedora Extras Quality Assurance
Depends On:
  Show dependency treegraph
Reported: 2009-01-26 03:04 EST by Pierre-YvesChibon
Modified: 2009-07-29 05:20 EDT (History)
2 users (show)

See Also:
Fixed In Version: 1.0.2-4.fc10
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2009-07-11 13:29:04 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)
Fix reversed return values from need_quote() (1.18 KB, patch)
2009-05-29 03:58 EDT, Toshio Ernie Kuratomi
no flags Details | Diff

  None (edit)
Description Pierre-YvesChibon 2009-01-26 03:04:58 EST
Description of problem:
Running this simple lines of code make pydot crash:

#-*- coding: UTF-8 -*-

import pydot
g = pydot.Dot()
g.add_edge(pydot.Edge(src='Anne-Cécile', dst='Anne-Marie'))
g.write('test.jpg', format='raw')

Version-Release number of selected component (if applicable):

How reproducible:

Steps to Reproduce:
1.Run the code given above
2.Enjoy :)
Actual results:
>>> g.write_jpeg('test.jpg')
Anne-Cécile [195, 169]
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python2.5/site-packages/pydot.py", line 1603, in <lambda>
    lambda path, f=frmt, prog=self.prog : self.write(path, format=f, prog=prog))
  File "/usr/lib/python2.5/site-packages/pydot.py", line 1697, in write
    dot_fd.write(self.create(prog, format))
  File "/usr/lib/python2.5/site-packages/pydot.py", line 1797, in create
    status, stderr_output) )
pydot.InvocationException: Program terminated with status: 6. stderr follows: Error: /tmp/tmpVEABbQ:2: syntax error near line 2
context:  >>> Anne- <<< Cécile;

Expected results:
>>> g.write_jpeg('test.jpg')

Additional info:
I managed to solve it by a dirty solution:

I commented these lines:
line 157
#    chars = [ord(c) for c in s if ord(c)>0x7f or ord(c)==0]
#    if chars:
#        print s, chars
#        return False
line 162
of the file /usr/lib/python2.5/site-packages/pydot.py

It's probably more a bug to report upstream but I have not find place where to do so...

Thanks for your help :)
Comment 1 Tom "spot" Callaway 2009-02-03 15:25:49 EST
Filed upstream:


I poked this for a while and couldn't come up with a fix.
Comment 2 Pierre-YvesChibon 2009-02-03 15:36:31 EST
Thanks for reporting it.

What do you think of the 4 lines I commented ?
Comment 3 Tom "spot" Callaway 2009-02-03 15:41:28 EST
Well, its not a real fix, for sure. I tried all sorts of things in that section of code to fix it properly, but without success.
Comment 4 Toshio Ernie Kuratomi 2009-05-29 03:29:38 EDT
There's some sort of bug in needs_quotes() and quote_if_necessary() but I haven't unravelled it yet.  It almost looks like needs_quotes() is returning the opposite values as it should.  ie: Returning False when quotes are needed and True when they aren't.  But at least one of the tests (id_re_dbl_quoted.match) is wrong if I just change every True to False and False to True.  So I need to understand that section of code a little bit better.
Comment 5 Toshio Ernie Kuratomi 2009-05-29 03:58:15 EDT
Created attachment 345862 [details]
Fix reversed return values from need_quote()

I think this is right but if you use this module with any frequency, a bit of testing would be appreciated :-)

Some of the return values were reversed in needs_quote() but regex checks were returning the correct value.  This patch should fix things up.
Comment 6 Toshio Ernie Kuratomi 2009-05-29 04:00:37 EDT
My test case was:

#-*- coding: UTF-8 -*-

import pydot
n1 = u'Th\xe9r\xe8se Doe'
n2 = u'Jean-Pierre Tou\xe9'
g = pydot.Dot()
g.add_edge(pydot.Edge(src=n1.encode('utf-8'), dst=n2.encode('utf-8')))
g.write('test.dot', format='raw')
Comment 7 Fedora Update System 2009-07-06 09:34:45 EDT
pydot-1.0.2-4.fc10 has been submitted as an update for Fedora 10.
Comment 8 Fedora Update System 2009-07-06 09:34:50 EDT
pydot-1.0.2-4.fc11 has been submitted as an update for Fedora 11.
Comment 9 Fedora Update System 2009-07-11 13:29:00 EDT
pydot-1.0.2-4.fc11 has been pushed to the Fedora 11 stable repository.  If problems still persist, please make note of it in this bug report.
Comment 10 Fedora Update System 2009-07-11 13:30:13 EDT
pydot-1.0.2-4.fc10 has been pushed to the Fedora 10 stable repository.  If problems still persist, please make note of it in this bug report.
Comment 11 Pierre-YvesChibon 2009-07-29 05:20:00 EDT
I just wanted to thank Toshio for the patch and Tom to push it, it works great for me :-)

Note You need to log in before you can comment on or make changes to this bug.