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

Parsing of favorite_counts ends up with NoneType is not callable exception. #365

Open
DennouNeko opened this issue Dec 31, 2024 · 10 comments

Comments

@DennouNeko
Copy link

It looks like version 0.4.18 of nhentai tool is stopping to work. At first it was just from time to time, but now I just kept getting "Tried yo get image id failed" every time.
I've tried updating to most recent 0.5.17. Pip installation didn't generate the executable in scripts, but at least manual instalation worked.
The tool was now giving me exception while parsing favorite_counts, regardless if I was downloading favorites or doujin directly from ID.

Traceback (most recent call last):
  File "\\?\C:\Program Files\Python312\Scripts\nhentai-script.py", line 33, in <module>
    sys.exit(load_entry_point('nhentai==0.5.17', 'console_scripts', 'nhentai')())
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Program Files\Python312\Lib\site-packages\nhentai\command.py", line 84, in main
    doujinshi_info = doujinshi_parser(doujinshi_id)
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Program Files\Python312\Lib\site-packages\nhentai\parser.py", line 152, in doujinshi_parser
    doujinshi['favorite_counts'] = favorite_counts.strip()
                                   ^^^^^^^^^^^^^^^^^^^^^^^
TypeError: 'NoneType' object is not callable

After a bit of investigation, it seems like there's just a small mistake in parser.py.
Line 152 should be changed from

    doujinshi['favorite_counts'] = favorite_counts.strip()

to

    doujinshi['favorite_counts'] = favorite_counts.text.strip()

And just in case, using the nHentai GUI v1.06 on Windows 10 with Python 3.12.

@DennouNeko
Copy link
Author

Never mind... Seems like the issue was caused by fiddling around and overwriting the git verrsion with pip update. Git version has all the necessary fixes.
It's the 0.5.17 available from pip that causes the exception to happen.

@denny1151
Copy link

Hello, I also encountered the issue "Tried to get image id failed."
I'm not sure how to solve it. I'm currently using nhentai-GUI.
Could I ask how you dealt with this problem?
Additionally, I was able to use it normally about four months ago.

Sorry, I really don't understand these programming languages.

@DennouNeko
Copy link
Author

The fix for me was to update the nhentai tool. Preferably you should uninstall any and all pip versions (if you have any) and install the one from git since pip installation of versions other than 0.4.18 doesn't create the executable that GUI needs (as reported in #364).

As for v0.4.18 itself, it seems like structure of website slightly changed and that version wasn't robust enough to handle it, but I'd have to take a closer look. Though it would explain why it was working fine up to certain point.

@RicterZ
Copy link
Owner

RicterZ commented Jan 6, 2025

I think this should be fixed already?

@RicterZ
Copy link
Owner

RicterZ commented Jan 6, 2025

I'm abroad so that I cannot push a fix commit, if the problem is figured out could you submit a pull request for this bug?

@DennouNeko
Copy link
Author

DennouNeko commented Jan 6, 2025

I did notice that it has been fixed in git already, but for some reason installation with pip grabs version that still has the issue. I've made sure just now that it still happens.
It seems that pip installs this commit because it has the updated version string, but not the next one with fix for #361 that was committed the same day.
So it seems like there's nothing to fix on git side, unless it needs a version bump.

@RicterZ
Copy link
Owner

RicterZ commented Jan 6, 2025 via email

@DennouNeko
Copy link
Author

Pretty much. That should fix the issue with pip install.

@RicterZ
Copy link
Owner

RicterZ commented Jan 7, 2025

Publish a new version 0.5.17.1, could you try it again?

@DennouNeko
Copy link
Author

pip downloaded v0.5.17.2, I guess there was one more version published in the mean time :)
I did remove any other versions before checking and got good news - it did create the executable in Scripts folder and download with GUI worked properly.

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

No branches or pull requests

3 participants