-
Notifications
You must be signed in to change notification settings - Fork 255
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
Ugoira FFMPEG permission denied during conversion #1132
Comments
I can't reproduce the error you have while converting the ugoira to gif. (log.log) |
Sure, [FFmpeg] [Ugoira] |
I still can't get the error. |
yes it still happens, here is the output you wanted: During handling of the above exception, another exception occurred: Traceback (most recent call last): During handling of the above exception, another exception occurred: Traceback (most recent call last): |
Ok, since I can't reproduce the error on my laptop, I'm gonna ask you to do mess around a little with your code. Then, can you modify lines 1146 and 1147 of the
To
Then you're gonna restart the script and tell me if you still have the error. |
Yeah, it is very random |
My bad, it was
If it's still doesn't work, I'm gonna see tomorrow if i can launch it on Windows. |
C:\WINDOWS\system32>pip show pillow Now it just crashes immediately. |
My Windows VM crashed and broke it's SSD. I won't be able to investigate the issue quickly |
I have had the same issue with a couple mp4 creations since the last update, which I hadn't had before. I'm using the bundled exe windows version as well. Image 99548831 is an example, which according to debug logging fails when trying to convert image 3 (000002.jpg). In this case, image 2 is grayscale image inside an otherwise full color ugoira (a line step inside a progress image), so the image conversion fails and it dumps out, and the whole program crashes a few steps later due to failing to clean up after itself as the last image in the directory was still claimed by the exe. I was able to edit the ugoira archive with the image upconverted to full color and the mp4 creation went through fine. My other failed convert was an NSFW case where the final image (a fade to black) had also been optimized down to a 8bpp image. I'd just deleted the problem image in the archive as it hadn't really mattered to the final input and that one went ahead. |
try to convert to webm? |
According to the description that you make @Phenrei, the cause of the problem probably comes from the modifications that I made on the conversion of the ugoira in the issue #1109 |
@anon1593 and @Phenrei, It took me long enough but I found the cause of your error. You only have to modify line 1138 of f = os.path.join(directory, filename) to f = os.path.join(directory, os.sep, filename) That should solve the issue, otherwise don't hesitate to raise any other error you might have. |
Thanks for tracking it down. I've only encountered it a couple more times since this post and it's quickly fixable from my end with a quick Irfanview reencode, so I'll just wait for the fix in the next build. My system python is a mess due to other programs so I end up using the exes. |
Changes merged :D |
@Toyem was Windows fix tested in a Linux environment?
On linux, this produces |
As mention by @cglmrfreeman just before, the fix I made for Windows creates an error on Linux (but it works just fine on MacOS). The error is not visible on the console output nor on the logs but by observing the results produced by the program, we observe (as for the issue 1109) that the beginning of the gifs have not been generated. The problem most likely comes from the behavior mention above of |
why not just do the old way? f = os.path.abspath(f"{directory}{os.sep}{filename}") |
At that point why prefix with |
On paper, the idea was good and it works for Unix OS (Linux and MacOs) but everything goes wrong on Windows.
It tended to create chimeras of path absolutely not readable for Windows. Hence the problem on this OS. |
Prerequisites
Description
Unknown Error, please check the log file: (<class 'PermissionError'>, PermissionError(13, 'The process cannot access the file because it is being used by another process'), <traceback object at 0x00000162F7FE92C0>)
PermissionError: [WinError 32] The process cannot access the file because it is being used by another process: 'C:/Users/1/AppData/Local/Temp/convert_ugoirab7yr3559\000139.jpg'
Highly random, some download fine, others error.
Experiencing this error for at least a month.
Steps to Reproduce
Download random ugoira and convert
Expected behavior: [What you expected to happen]
Download and convert to gif & webm
Actual behavior: [What actually happened]
Fatal error
Log file: [Attach the
pixivutil.log
file in the application folder, recommended to delete the old file, reproduce the issue, and upload the newly generated file here]2022-07-03 13:42:22,945 - PixivUtil20220701 - INFO - ###############################################################
2022-07-03 13:42:22,945 - PixivUtil20220701 - INFO - Starting with argument: [C:\PixivUtil2\PixivUtil2.py].
2022-07-03 13:42:22,945 - PixivUtil20220701 - INFO - Setting log level to: DEBUG
2022-07-03 13:42:22,945 - PixivUtil20220701 - INFO - No default cookie jar available, creating...
2022-07-03 13:42:23,102 - PixivUtil20220701 - INFO - Using default DB Path: C:\PixivUtil2\db.sqlite
2022-07-03 13:42:23,117 - PixivUtil20220701 - INFO - Using Blacklist Tags: 11 items.
2022-07-03 13:42:23,117 - PixivUtil20220701 - INFO - Using Blacklist Members: 7 members.
2022-07-03 13:42:25,439 - PixivUtil20220701 - INFO - Trying to log in with saved cookie
2022-07-03 13:42:26,615 - PixivUtil20220701 - INFO - Logging in, return url: https://www.pixiv.net/en/
2022-07-03 13:42:26,631 - PixivUtil20220701 - INFO - Login successful.
2022-07-03 13:42:26,631 - PixivUtil20220701 - INFO - Logged in using cookie
2022-07-03 13:42:26,631 - PixivUtil20220701 - INFO - My User Id: 8870660.
2022-07-03 13:42:26,631 - PixivUtil20220701 - INFO - Premium User: False.
2022-07-03 13:42:26,631 - PixivUtil20220701 - INFO - Locale = /en
2022-07-03 13:42:26,701 - PixivUtil20220701 - INFO - Using Blacklist Tags: 11 items.
2022-07-03 13:42:26,709 - PixivUtil20220701 - INFO - Using Blacklist Members: 7 members.
2022-07-03 13:42:39,797 - PixivUtil20220701 - INFO - Image id mode (2).
2022-07-03 13:42:41,104 - PixivUtil20220701 - DEBUG - Getting image page: 83158226
2022-07-03 13:42:41,470 - PixivUtil20220701 - DEBUG - New UI Mode
2022-07-03 13:42:42,023 - PixivUtil20220701 - DEBUG - using webrpc: https://www.pixiv.net/rpc/get_work.php?id=83158226
2022-07-03 13:42:43,202 - PixivUtil20220701 - DEBUG - Sanitized Filename: C:\01\wirai (10428223)\83158226_ugoira1920x1080 - Maid suit.zip
2022-07-03 13:42:43,203 - PixivUtil20220701 - INFO - Filename : C:\01\wirai (10428223)\83158226_ugoira1920x1080 - Maid suit.zip
2022-07-03 13:42:43,204 - PixivUtil20220701 - INFO - Creating directory: C:\01\wirai (10428223)
2022-07-03 13:42:43,207 - PixivUtil20220701 - INFO - Using Referer: https://www.pixiv.net/artworks/83158226
2022-07-03 13:42:43,787 - PixivUtil20220701 - INFO - Using Referer: https://www.pixiv.net/artworks/83158226
2022-07-03 13:42:55,743 - PixivUtil20220701 - INFO - done.
2022-07-03 13:42:55,744 - PixivUtil20220701 - INFO - Creating ugoira archive => C:\01\wirai (10428223)\83158226_ugoira1920x1080 - Maid suit.ugoira
2022-07-03 13:42:55,751 - PixivUtil20220701 - INFO - Processing ugoira to animated gif...
2022-07-03 13:42:55,908 - PixivUtil20220701 - DEBUG - Procced to change C:/Users/1/AppData/Local/Temp/convert_ugoirab7yr3559\000139.jpg image for a pixel format with 3 components
2022-07-03 13:42:55,908 - PixivUtil20220701 - INFO - [re_encode_image()] running with cmd: ffmpeg -i C:/Users/1/AppData/Local/Temp/convert_ugoirab7yr3559\000139.jpg -pix_fmt gbrpf32be C:/Users/1/AppData/Local/Temp/convert_ugoirab7yr3559\000139_temp.jpg
2022-07-03 13:42:55,912 - PixivUtil20220701 - DEBUG - Start re_encoding image C:/Users/1/AppData/Local/Temp/convert_ugoirab7yr3559\000139.jpg
2022-07-03 13:42:56,015 - PixivUtil20220701 - ERROR - Error at process_image(): 83158226
2022-07-03 13:42:56,016 - PixivUtil20220701 - ERROR - Traceback (most recent call last):
File "C:\PixivUtil2\PixivHelper.py", line 1053, in convert_ugoira
check_image_encoding(d)
File "C:\PixivUtil2\PixivHelper.py", line 1162, in check_image_encoding
re_encode_image(re_encode_channel, file)
File "C:\PixivUtil2\PixivHelper.py", line 1193, in re_encode_image
raise PixivException("error", f"Failed when converting image using {cmd} ==> ffmpeg return exit code={p.returncode}, expected to return 0.", errorCode=PixivException.OTHER_ERROR)
PixivException.PixivException: PixivException(9999 error, hasDumpPage=N)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\PixivUtil2\PixivImageHandler.py", line 336, in process_image
PixivDownloadHandler.handle_ugoira(image, filename, config, notifier)
File "C:\PixivUtil2\PixivDownloadHandler.py", line 384, in handle_ugoira
PixivHelper.ugoira2gif(ugo_name,
File "C:\PixivUtil2\PixivHelper.py", line 967, in ugoira2gif
convert_ugoira(ugoira_file,
File "C:\PixivUtil2\PixivHelper.py", line 1080, in convert_ugoira
shutil.rmtree(d)
File "C:\Python310\lib\shutil.py", line 739, in rmtree
return _rmtree_unsafe(path, onerror)
File "C:\Python310\lib\shutil.py", line 617, in _rmtree_unsafe
onerror(os.unlink, fullname, sys.exc_info())
File "C:\Python310\lib\shutil.py", line 615, in _rmtree_unsafe
os.unlink(fullname)
PermissionError: [WinError 32] The process cannot access the file because it is being used by another process: 'C:/Users/1/AppData/Local/Temp/convert_ugoirab7yr3559\000139.jpg'
2022-07-03 13:42:56,018 - PixivUtil20220701 - ERROR - Exception: (<class 'PermissionError'>, PermissionError(13, 'The process cannot access the file because it is being used by another process'), <traceback object at 0x00000162F7FF2AC0>)
2022-07-03 13:42:56,019 - PixivUtil20220701 - ERROR - Traceback (most recent call last):
File "C:\PixivUtil2\PixivHelper.py", line 1053, in convert_ugoira
check_image_encoding(d)
File "C:\PixivUtil2\PixivHelper.py", line 1162, in check_image_encoding
re_encode_image(re_encode_channel, file)
File "C:\PixivUtil2\PixivHelper.py", line 1193, in re_encode_image
raise PixivException("error", f"Failed when converting image using {cmd} ==> ffmpeg return exit code={p.returncode}, expected to return 0.", errorCode=PixivException.OTHER_ERROR)
PixivException.PixivException: PixivException(9999 error, hasDumpPage=N)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\PixivUtil2\PixivImageHandler.py", line 336, in process_image
PixivDownloadHandler.handle_ugoira(image, filename, config, notifier)
File "C:\PixivUtil2\PixivDownloadHandler.py", line 384, in handle_ugoira
PixivHelper.ugoira2gif(ugo_name,
File "C:\PixivUtil2\PixivHelper.py", line 967, in ugoira2gif
convert_ugoira(ugoira_file,
File "C:\PixivUtil2\PixivHelper.py", line 1080, in convert_ugoira
shutil.rmtree(d)
File "C:\Python310\lib\shutil.py", line 739, in rmtree
return _rmtree_unsafe(path, onerror)
File "C:\Python310\lib\shutil.py", line 617, in _rmtree_unsafe
onerror(os.unlink, fullname, sys.exc_info())
File "C:\Python310\lib\shutil.py", line 615, in _rmtree_unsafe
os.unlink(fullname)
PermissionError: [WinError 32] The process cannot access the file because it is being used by another process: 'C:/Users/1/AppData/Local/Temp/convert_ugoirab7yr3559\000139.jpg'
2022-07-03 13:42:56,019 - PixivUtil20220701 - DEBUG - Sanitized Filename: Error medium page for image 83158226.html
2022-07-03 13:42:56,020 - PixivUtil20220701 - ERROR - Dumping html to: Error medium page for image 83158226.html
2022-07-03 13:42:56,021 - PixivUtil20220701 - ERROR - Traceback (most recent call last):
File "C:\PixivUtil2\PixivHelper.py", line 1053, in convert_ugoira
check_image_encoding(d)
File "C:\PixivUtil2\PixivHelper.py", line 1162, in check_image_encoding
re_encode_image(re_encode_channel, file)
File "C:\PixivUtil2\PixivHelper.py", line 1193, in re_encode_image
raise PixivException("error", f"Failed when converting image using {cmd} ==> ffmpeg return exit code={p.returncode}, expected to return 0.", errorCode=PixivException.OTHER_ERROR)
PixivException.PixivException: PixivException(9999 error, hasDumpPage=N)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\PixivUtil2\PixivImageHandler.py", line 336, in process_image
PixivDownloadHandler.handle_ugoira(image, filename, config, notifier)
File "C:\PixivUtil2\PixivDownloadHandler.py", line 384, in handle_ugoira
PixivHelper.ugoira2gif(ugo_name,
File "C:\PixivUtil2\PixivHelper.py", line 967, in ugoira2gif
convert_ugoira(ugoira_file,
File "C:\PixivUtil2\PixivHelper.py", line 1080, in convert_ugoira
shutil.rmtree(d)
File "C:\Python310\lib\shutil.py", line 739, in rmtree
return _rmtree_unsafe(path, onerror)
File "C:\Python310\lib\shutil.py", line 617, in _rmtree_unsafe
onerror(os.unlink, fullname, sys.exc_info())
File "C:\Python310\lib\shutil.py", line 615, in _rmtree_unsafe
os.unlink(fullname)
PermissionError: [WinError 32] The process cannot access the file because it is being used by another process: 'C:/Users/1/AppData/Local/Temp/convert_ugoirab7yr3559\000139.jpg'
2022-07-03 13:42:56,036 - PixivUtil20220701 - ERROR - Unknown Error: [WinError 32] The process cannot access the file because it is being used by another process: 'C:/Users/1/AppData/Local/Temp/convert_ugoirab7yr3559\000139.jpg'
Traceback (most recent call last):
File "C:\PixivUtil2\PixivHelper.py", line 1053, in convert_ugoira
check_image_encoding(d)
File "C:\PixivUtil2\PixivHelper.py", line 1162, in check_image_encoding
re_encode_image(re_encode_channel, file)
File "C:\PixivUtil2\PixivHelper.py", line 1193, in re_encode_image
raise PixivException("error", f"Failed when converting image using {cmd} ==> ffmpeg return exit code={p.returncode}, expected to return 0.", errorCode=PixivException.OTHER_ERROR)
PixivException.PixivException: PixivException(9999 error, hasDumpPage=N)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\PixivUtil2\PixivUtil2.py", line 1725, in main
np_is_valid, op_is_valid, selection = main_loop(ewd, op_is_valid, selection, np_is_valid, args, options)
File "C:\PixivUtil2\PixivUtil2.py", line 1399, in main_loop
menu_download_by_image_id(op_is_valid, args, options)
File "C:\PixivUtil2\PixivUtil2.py", line 342, in menu_download_by_image_id
PixivImageHandler.process_image(sys.modules[name],
File "C:\PixivUtil2\PixivImageHandler.py", line 336, in process_image
PixivDownloadHandler.handle_ugoira(image, filename, config, notifier)
File "C:\PixivUtil2\PixivDownloadHandler.py", line 384, in handle_ugoira
PixivHelper.ugoira2gif(ugo_name,
File "C:\PixivUtil2\PixivHelper.py", line 967, in ugoira2gif
convert_ugoira(ugoira_file,
File "C:\PixivUtil2\PixivHelper.py", line 1080, in convert_ugoira
shutil.rmtree(d)
File "C:\Python310\lib\shutil.py", line 739, in rmtree
return _rmtree_unsafe(path, onerror)
File "C:\Python310\lib\shutil.py", line 617, in _rmtree_unsafe
onerror(os.unlink, fullname, sys.exc_info())
File "C:\Python310\lib\shutil.py", line 615, in _rmtree_unsafe
os.unlink(fullname)
PermissionError: [WinError 32] The process cannot access the file because it is being used by another process: 'C:/Users/1/AppData/Local/Temp/convert_ugoirab7yr3559\000139.jpg'
2022-07-03 13:42:56,039 - PixivUtil20220701 - ERROR - Unknown Error, please check the log file: (<class 'PermissionError'>, PermissionError(13, 'The process cannot access the file because it is being used by another process'), <traceback object at 0x00000162F7FE92C0>)
2022-07-03 13:42:56,040 - PixivUtil20220701 - ERROR - Traceback (most recent call last):
File "C:\PixivUtil2\PixivHelper.py", line 1053, in convert_ugoira
check_image_encoding(d)
File "C:\PixivUtil2\PixivHelper.py", line 1162, in check_image_encoding
re_encode_image(re_encode_channel, file)
File "C:\PixivUtil2\PixivHelper.py", line 1193, in re_encode_image
raise PixivException("error", f"Failed when converting image using {cmd} ==> ffmpeg return exit code={p.returncode}, expected to return 0.", errorCode=PixivException.OTHER_ERROR)
PixivException.PixivException: PixivException(9999 error, hasDumpPage=N)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\PixivUtil2\PixivUtil2.py", line 1725, in main
np_is_valid, op_is_valid, selection = main_loop(ewd, op_is_valid, selection, np_is_valid, args, options)
File "C:\PixivUtil2\PixivUtil2.py", line 1399, in main_loop
menu_download_by_image_id(op_is_valid, args, options)
File "C:\PixivUtil2\PixivUtil2.py", line 342, in menu_download_by_image_id
PixivImageHandler.process_image(sys.modules[name],
File "C:\PixivUtil2\PixivImageHandler.py", line 336, in process_image
PixivDownloadHandler.handle_ugoira(image, filename, config, notifier)
File "C:\PixivUtil2\PixivDownloadHandler.py", line 384, in handle_ugoira
PixivHelper.ugoira2gif(ugo_name,
File "C:\PixivUtil2\PixivHelper.py", line 967, in ugoira2gif
convert_ugoira(ugoira_file,
File "C:\PixivUtil2\PixivHelper.py", line 1080, in convert_ugoira
shutil.rmtree(d)
File "C:\Python310\lib\shutil.py", line 739, in rmtree
return _rmtree_unsafe(path, onerror)
File "C:\Python310\lib\shutil.py", line 617, in _rmtree_unsafe
onerror(os.unlink, fullname, sys.exc_info())
File "C:\Python310\lib\shutil.py", line 615, in _rmtree_unsafe
os.unlink(fullname)
PermissionError: [WinError 32] The process cannot access the file because it is being used by another process: 'C:/Users/1/AppData/Local/Temp/convert_ugoirab7yr3559\000139.jpg'
Versions
You can get this information from executing
PixivUtil2.py --help
.Latest Commit as of 7/3/2022 1:00PM
The text was updated successfully, but these errors were encountered: