Matt Bachmann added the comment:

There is a difference! '.' is a bytes string and u'.' is a unicode one! 

I found this problem because I work on a project that supports both python2 and 
python3.

In python3 I pass in unicode I get back unicode. In python2.7 I pass in unicode 
and I get back a bytes string. We need to ensure that all data in the system is 
unicode. 

Under 2.7 I get unicode sometimes and bytes other times so I need to do this 
ugly check 

    root_rel_path = os.path.relpath(self._cwd, self._root)
    if isinstance(root_rel_path, six.binary_type):
        root_rel_path = root_rel_path.decode()

in order to ensure that my string is once again of the correct type.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue21343>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to