Skip to content

Error with keyword print_paths #262

@therealpeterpython

Description

@therealpeterpython

First of all, I would like to thank you for the great work!
I've tried the following commands:

arguments = {"keywords": "spam and eggs", "limit":1, "print_paths":True} 
response = google_images_download.googleimagesdownload()  
var = response.download(arguments)

and got this error message:

Item no.: 1 --> Item name = spam and eggs
Evaluating...
Starting Download...
Completed Image ====> 1.spam-and-scrambled-eggs-655.jpg

Errors: 0

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "D:\...\Python36-32\lib\site-packages\google_images_download\google_images_download.py", line 830, in download
    print(paths.encode('raw_unicode_escape').decode('utf-8'))
AttributeError: 'dict' object has no attribute 'encode'

I've investigated this error further and the problem lies in line 830 where paths is a dictionary:

if arguments['print_paths']:
    print(paths.encode('raw_unicode_escape').decode('utf-8'))

If i understood the code correctly, something like:

if arguments['print_paths']:                  
    for i in paths:
        paths[i] = [s.encode('raw_unicode_escape').decode('utf-8') for s in paths[i]]
    print(paths)

should fix the problem.

Greetings, therealpeterpython

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions