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

"TypeError: cannot unpack non-iterable NoneType object" on import-from-url #64

Closed
Kalidibus opened this issue Dec 28, 2024 · 2 comments
Closed
Assignees
Labels
bug Something isn't working

Comments

@Kalidibus
Copy link

Kalidibus commented Dec 28, 2024

root@d7ed44db5a0a:/szurubooru-toolkit# szuru-toolkit import-from-url --cookies ./misc/cookies.txt --range ':100' 'https://x.com/kalidibus/likes/'

[INFO] Downloading posts from URLs ['https://x.com/kalidibus/likes/']... [INFO] Downloaded 99 post(s). Start importing... 4%|█▊ | 4/99 [00:05<01:44, 1.10s/it]

[WARNING] [upload_media.upload_file] An error occured during the upload for file "None": Parameter 'tags' must be a list of string values. [ERROR] [szuru_toolkit.click_import_from_url] An error has been caught in function 'click_import_from_url', process 'MainProcess' (21), thread 'MainThread' (140255465323392): Traceback (most recent call last): File "/szurubooru-toolkit/src/szurubooru_toolkit/scripts/szuru_toolkit.py", line 505, in click_import_from_url module.main(list(urls), input_file, add_tags, verbose) File "/szurubooru-toolkit/src/szurubooru_toolkit/scripts/import_from_url.py", line 193, in main saucenao_limit_reached = upload_media.main( File "/szurubooru-toolkit/src/szurubooru_toolkit/scripts/upload_media.py", line 435, in main _, saucenao_limit_reached = upload_post(file_to_upload, file_ext, metadata, saucenao_limit_reached=saucenao_limit_reached) TypeError: cannot unpack non-iterable NoneType object

@reluce reluce self-assigned this Dec 28, 2024
@reluce reluce added the bug Something isn't working label Dec 28, 2024
@Kalidibus
Copy link
Author

Just to add some additional details, this is a brand new docker container using the current git repo as of yesterday.

Repeating the command fails on the same item to download each time it seems.

@reluce
Copy link
Owner

reluce commented Jan 6, 2025

It seems that post.tags is None. Tags are being set from the gallery-dl json file:

if 'tags' in metadata or 'tag_string' in metadata or 'hashtags' in metadata:
metadata['tags'] = set_tags(metadata)
else:
metadata['tags'] = []
if site == 'twitter':
metadata['tags'] += extract_twitter_artist(metadata)

You can try to narrow it down by looking into each json file if there is something funky going on with the extracted tags. Or you could print post.tags in the exception statement:

except Exception as e:
logger.warning(f'An error occured during the upload for file "{post.file_path}": {e}')
return None

For now, I'll set the tags to the default tags from config.toml in case they are None, so the upload should work. If config.upload_media['tags'] is not set in your config.toml, it defaults to tagme.

I'll push a new release soon (1.0.3). In case it still doesn't work, you can re-open this issue.

@reluce reluce closed this as completed in c9c835e Jan 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants