Skip to content

Scrapy, a fast high-level web crawling & scraping framework for Python.

make utils.project.data_path return path unmodified when outside project

Elias Dorneles8e4947ef0dd4
diff --git a/scrapy/utils/project.py b/scrapy/utils/project.py
index a15a0d90f..9258469ee 100644
--- a/scrapy/utils/project.py
+++ b/scrapy/utils/project.py
@@ -40,10 +40,10 @@ def project_data_dir(project='default'):
return d
def data_path(path, createdir=False):
- """If path is relative, return the given path inside the project data dir,
- otherwise return the path unmodified
+ """If inside the project and path is relative, return the given path
+ as relative the project data dir, otherwise return it unmodified
"""
- if not isabs(path):
+ if inside_project() and not isabs(path):
path = join(project_data_dir(), path)
if createdir and not exists(path):
os.makedirs(path)