Start a new topic

IOError while deplying

I have a piece of code in my spider that read a csv file and it fails 

any solution



 File "/tmp/unpacked-eggs/__main__.egg/kompassdotcom/spiders/basic.py", line 40, in BasicSpider
    with open(company_path, "r") as f:
IOError: [Errno 2] No such file or directory: '/tmp/unpacked-eggs/__main__.egg/kompassdotcom/input/test_companies.csv'
{"message": "shub-image-info exit code: 1", "details": null, "error": "image_info_error"}
{"status": "error", "message": "Internal error"}

 


and here is my setup file

what I can see that is build/lib input directory is not mirrored 


setup(
name = 'project',
version = '1.0',
packages = find_packages(),
package_data={
'project': ['input/*.csv']
},
entry_points = {'scrapy': ['settings = kompassdotcom.settings']},
zip_safe=False,
)
1.png
(27.2 KB)

Yes I did. 

the folder input aint created in build

if you have a look into attached 1.png, you'll see the structure of the project 

The article suggests to use:


import pkgutil   

data = pkgutil.get_data("myproject","resources/cities.txt")


It seems like you're trying to open() it. By using pkgutil, you're are already reading the data and there's no need to use open().

Login to post a comment