Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error with keyword print_paths #262

Open
therealpeterpython opened this issue Aug 31, 2019 · 0 comments · May be fixed by #265
Open

Error with keyword print_paths #262

therealpeterpython opened this issue Aug 31, 2019 · 0 comments · May be fixed by #265

Comments

@therealpeterpython
Copy link

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

therealpeterpython added a commit to therealpeterpython/google-images-download that referenced this issue Sep 1, 2019
@therealpeterpython therealpeterpython linked a pull request Sep 1, 2019 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant