[Twisted-Python] t.p.filepath and Unicode

Wolfgang Rohdewald wolfgang.kde at rohdewald.de
Sun Mar 8 05:30:38 MDT 2015


Am Sonntag, 8. März 2015, 10:03:03 schrieb Adi Roiban:
> Hi,
> 
> I am trying to help porting Twisted on Py3 and for me the fact that
> FilePath requires all paths to be bytes is a constant pain.
> 
> To reduce the Unicode pain when working with string my principle is to
> do all internal operations in Unicode and then convert to bytes only
> at input and output.
> 
> Right now I am trying to port t.p.moduled and when using the current
> implementation of FilePath I have to constantly encode/decode path. I
> would prefer not to consider the FilePath an input/output level.
> 
> Does anyone find this useful and plan to use FilePath with bytes in
> another Python3 project?
> 
> What do you say if we will also have an UnicodeFilePath class  which
> only accept Unicode as path input and only outputs Unicode?
> 
> It can start with simple path traversal/directory creation/file
> creation just to have t.p.moduled (and trial) ported.
> 
> Thanks!
> 

Some months ago someone outlined his idea, I believe in the mailing
list in a thread I participated in. I do not remember who it
was. IIRC, the plan was that FilePath accepts all types of string. It 
keeps a 1:1 copy of that string and has attributes returning the
variant that the caller needs, converting on the fly.


There also is bug report 7166.

-- 
Wolfgang




More information about the Twisted-Python mailing list