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

Problems with creating/testing paths if the username or image title contains dots #627

Closed
mugi-jiichan opened this issue Jan 21, 2020 · 0 comments

Comments

@mugi-jiichan
Copy link

Prerequisites

  • [ X ] Did you read FAQ section?
  • [ X ] Did you test with the latest releases or commit ?

Description

Using PixivUtil 20200112 on Windows 10 Build 1903 and 1909. This looks a lot like the error explained in #542 - however, I was not able to solve the problem by setting a rootdirectory as advised.

Partially, this error is probably Windows specific due to the system's naming conventions which do not allow closing dots and empty spaces. There also seems to be a different handling of how images are downloaded images through options 1 (whole illustration gallery) and 2 (specific image).

So, in the config.ini, the current naming pattern is:

[Filename]
filenameformat = %member_id%_%artist%\[%R-18%]\%works_date_fmt{%Y\%m-%b}%\%image_id%_%title%\%urlFilename%
filenamemangaformat = %member_id%_%artist%\[%R-18%]\%works_date_fmt{%Y\%m-%b}%\%image_id%_%title%\%urlFilename%
filenameinfoformat = %member_id%_%artist%\[%R-18%]\%works_date_fmt{%Y\%m-%b}%\%image_id%_%title%\%urlFilename%
avatarnameformat = %member_id%_%artist%\%image_id%_Avatar\%urlFilename%
tagsseparator = ,
createmangadir = False
usetagsasdir = False
urldumpfilename = url_lists\%Y%m%d

I've checked to have entered a rootdirectory in the config.ini as suggested in #542 by setting:
rootdirectory = .\downloads

Take Image Id 75693481, for example. The extracted title is "Hinata NTR 3 . .." (I am sorry but pixiv search doesn't let me search of the title anymore to look for the odd string ". ..", there's likely another safe image to review this error for sure.)

If I am using PixivUtil from any kind of drive (NAS, local installed, removable), the application throws an exception.

The error is handled while downloading the whole illustration gallery of the user in option 1 by downloading the image to the rootdirectory:

--- Logging error ---
Traceback (most recent call last):
  File "PixivImage.pyc", line 335, in WriteInfo
  File "codecs.pyc", line 905, in open
FileNotFoundError: [Errno 2] No such file or directory: 'Z:\\pixiv-Grinder\\0_ID\\downloads\\12472261_Nuo\\[R-18]\\2019\\07-Jul\\75693481_Hinata NTR 3 .\\75693481.txt'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "logging\handlers.pyc", line 69, in emit
  File "logging\handlers.pyc", line 185, in shouldRollover
  File "logging\__init__.pyc", line 925, in format
  File "logging\__init__.pyc", line 664, in format
  File "logging\__init__.pyc", line 369, in getMessage
TypeError: %d format: a number is required, not str
Call stack:
  File "PixivUtil2.py", line 2460, in <module>
  File "PixivUtil2.py", line 2429, in main
  File "PixivUtil2.py", line 2141, in main_loop
  File "PixivUtil2.py", line 1551, in menu_download_by_member_id
  File "PixivUtil2.py", line 553, in process_member
  File "PixivUtil2.py", line 820, in process_image
  File "PixivImage.pyc", line 338, in WriteInfo
  File "logging\__init__.pyc", line 1469, in exception
  File "logging\__init__.pyc", line 1463, in error
  File "logging\__init__.pyc", line 1577, in _log
  File "logging\__init__.pyc", line 1587, in handle
  File "logging\__init__.pyc", line 1649, in callHandlers
  File "logging\__init__.pyc", line 950, in handle
  File "logging\handlers.pyc", line 73, in emit
Message: 'Error when saving image info: %s, file is saved to: %d.txt'
Arguments: ('Z:\\pixiv-Grinder\\0_ID\\downloads\\12472261_Nuo\\[R-18]\\2019\\07-Jul\\75693481_Hinata NTR 3 .\\75693481.txt', '75693481')

Downloading the image through its image id directly through option 2, the appliocation throws an exception and exits to prompt.

Traceback (most recent call last):
  File "PixivUtil2.py", line 797, in process_image
  File "PixivUtil2.py", line 137, in download_image
FileNotFoundError: [Errno 2] No such file or directory: 'H:\\pixiv-Grinder\\0_ID\\downloads\\12472261_Nuo\\[R-18]\\2019\\07-Jul\\75693481_Hinata NTR 3 .\\あいうえお.test'
Error at process_image(): 75693481
Exception: (<class 'FileNotFoundError'>, FileNotFoundError(2, 'No such file or directory'), <traceback object at 0x153EC568>)
Dumping html to: Error medium page for image 75693481.html
Traceback (most recent call last):
  File "PixivUtil2.py", line 2429, in main
  File "PixivUtil2.py", line 2143, in main_loop
  File "PixivUtil2.py", line 1607, in menu_download_by_image_id
  File "PixivUtil2.py", line 797, in process_image
  File "PixivUtil2.py", line 137, in download_image
FileNotFoundError: [Errno 2] No such file or directory: 'H:\\pixiv-Grinder\\0_ID\\downloads\\12472261_Nuo\\[R-18]\\2019\\07-Jul\\75693481_Hinata NTR 3 .\\あいうえお.test'
press enter to exit.

I've copied the setup over to different drives and used the same configuration, changed the rootdirectory, but from whichever drive I use PixivUtil, I can see this error message, and PU is exiting.

As initially explained, I think this is possibly a Windows specific problem:
Windows shaves off the ending dots and empty spaces from the titledown to "75693481_Hinata NTR 3", if I recreate the naming pattern manually by either Windows Explorer, command line or PowerShell. So whatever PixivUtil created, it will also end up with "75693481_Hinata NTR 3" - however, the application searches for "75693481_Hinata NTR 3 ." and can't find the folder.

I've also accessed to my NAS via Putty and was able to create both a directory and a symlink with the actual name "75693481_Hinata NTR 3. ..", which is shortened to "75693481_Hinata NTR 3 ." because empty spaces and dots are actually allowed there. However, Windows garbles up that filename to "743DTA~J" - both Explorer and PowerShell.

Steps to Reproduce

  1. Use the naming pattern
  2. Run option 2
  3. Use the example ID (that has a title is not consistent or illegal with the naming conventions)
  4. [and so on...]

Expected behavior: [What you expected to happen]

Any option should download the image(s) to the root directory and create the image description file there, too.

Actual behavior: [What actually happened]

If the title is used in the naming pattern, and a title is used that is not compatible with the OS' naming conventions:

  1. Trying to download the image directly, throws the error exception that makes PixivUtil exit to prompt because a test file called あいうえお.test was not found.
  2. Trying to download the image with the whole illustration gallery will skip the search for the test file apparently, so the exception does not throw the user back to prompt. The image is saved to rootdirectory while the image description is not.

Versions

20200112 [and before]

35122 pushed a commit to 35122/PixivUtil2 that referenced this issue Oct 30, 2020
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

1 participant