This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author terry.reedy
Recipients Rosuav, apalala, terry.reedy
Date 2014-03-02.20:01:51
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1393790512.91.0.307892552158.issue15618@psf.upfronthosting.co.za>
In-reply-to
Content
The particular error message is an artifact of 'red' having 3 letters, so that r,g,b = 'red' 'works'. turtle.pencolor(u'blue') raises
turtle.TurtleGraphicsError: bad color arguments: blue.

In general, 'solves the problem' is a bit vague. In this case, it should mean 'make the exception go away and actually actually changes the pencolor', which the patch does. Chunk 2 patches ._colorstr. Once a unicode passes the revised test, the subsequent line
        if self._iscolorstring(color) or color == "":
works because a) ._iscolorstring calls into tk, which is unicode based, and b) in 2.x, the comparison u''=='' is True. To be applied, test/test_turtle.py would need to have one or more tests added.

Chunks 2, 3, and 4 should fix all color issues. Chunk 1 is about file names instead. Though not stated, the intent appears to be to fix all possible issues with unicode_literals, as should be done if any are.  (I did verify that there are no other isinstance(x, str) checks.) In particular, chunk 1 needs a test. Does
                if data.lower().endswith(".gif") and isfile(data):
                    data = TurtleScreen._image(data)
work when data is unicode? The unicode==str comparison works. Does os.path.isfile(unicode) work?  The os.path doc does not specify 'path', but unicode seems to work. TurtleScreen._image returns
        return TK.PhotoImage(file=filename)
I have not found any doc on whether the file option on 2.7 widgets can be unicode or not.

I asked on pydev about the generic issue of a 2.7 param being documented as a 'string' and the __future__ import changing str to unicode in thread 'unicode_string future, str -> basestring, fix or feature'.
History
Date User Action Args
2014-03-02 20:01:52terry.reedysetrecipients: + terry.reedy, Rosuav, apalala
2014-03-02 20:01:52terry.reedysetmessageid: <1393790512.91.0.307892552158.issue15618@psf.upfronthosting.co.za>
2014-03-02 20:01:52terry.reedylinkissue15618 messages
2014-03-02 20:01:51terry.reedycreate