From 57189e1b92bb5ab83a42bca54b8d997459c6b640 Mon Sep 17 00:00:00 2001 From: Pablo Hoffman Date: Mon, 26 Jan 2009 23:31:04 +0000 Subject: [PATCH] =?UTF-8?q?applied=20Patrick=20M=C3=A9zard=20patch=20for?= =?UTF-8?q?=20loading=20local=20files?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --HG-- extra : convert_revision : svn%3Ab85faa78-f9eb-468e-a121-7cced6da292c%40777 --- scrapy/trunk/scrapy/command/commands/shell.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/scrapy/trunk/scrapy/command/commands/shell.py b/scrapy/trunk/scrapy/command/commands/shell.py index 32bacd20b..541f8be8a 100644 --- a/scrapy/trunk/scrapy/command/commands/shell.py +++ b/scrapy/trunk/scrapy/command/commands/shell.py @@ -1,6 +1,6 @@ from twisted.internet import reactor -import urlparse +import os, urllib, urlparse import scrapy from scrapy.command import ScrapyCommand from scrapy.spider import spiders @@ -60,6 +60,11 @@ class Command(ScrapyCommand): def get_url(self, url): u = urlparse.urlparse(url) + if not u.scheme: + path = os.path.abspath(url).replace(os.sep, '/') + url = 'file://' + urllib.pathname2url(path) + u = urlparse.urlparse(url) + if u.scheme not in ('http', 'https', 'file'): print "Unsupported scheme '%s' in URL: <%s>" % (u.scheme, url) return