[reportlab-users] open_for_read and Window file paths

Robin Becker reportlab-users@reportlab.com
Thu, 03 Jun 2004 09:25:20 +0100


Jerome Alet wrote:

> On Thu, Jun 03, 2004 at 08:59:56AM +0100, Robin Becker wrote:
> 
> 
>>Can anyone think of a reliable rule for legal schemes that we should allow?
> 
> 
> the ones accepted by the urlparse standard module maybe ?
> 
> hth
> 
> Jerome Alet

Unfortunately I just tried a couple of experiments which convince me 
this is a hard problem. The file: scheme allows for a hostname so we 
should be using urlopen for that case. Unfortunately

 >>> urlparse('c:/code/reportlab/test/pythonpowered.gif')
('c', '', '/code/reportlab/test/pythonpowered.gif', '', '', '')

 >>> urlparse('yabadaba:/code/reportlab/test/pythonpowered.gif')
('yabadaba', '', '/code/reportlab/test/pythonpowered.gif', '', '', '')

ie urlparse is not validating the scheme in any way. I hate to think 
what'll happen with mac file names containing : :(

-- 
Robin Becker