KnugiHK / WhatsApp-Chat-Exporter

A customizable Android and iOS/iPadOS WhatsApp database parser that will give you the history of your WhatsApp conversations in HTML and JSON. Android Backup Crypt12, Crypt14, Crypt15, and new schema supported.
https://wts.knugi.dev/
MIT License
625 stars 88 forks source link

impossible to create a file it already exists #14

Closed kintaro1981 closed 1 year ago

kintaro1981 commented 2 years ago

Hello and thank you for your work!

I'm getting this error, now:

c:\Users\MYUSER\Desktop\PARA\1_Progetti\wabackup\working_wts>wtsexporter -i -b "C:\Users\MYUSER\AppData\Roaming\Apple Computer\MobileSync\Backup\MYID" Traceback (most recent call last): File "C:\Python310\lib\runpy.py", line 196, in _run_module_as_main return _run_code(code, main_globals, None, File "C:\Python310\lib\runpy.py", line 86, in _run_code exec(code, run_globals) File "C:\Python310\Scripts\wtsexporter.exe__main.py", line 7, in File "C:\Python310\lib\site-packages\Whatsapp_Chat_Exporter\main__.py", line 157, in main extract_iphone_media.extract_media(options.backup) File "C:\Python310\lib\site-packages\Whatsapp_Chat_Exporter\extract_iphone_media.py", line 118, in extract_media os.mkdir(destination) FileExistsError: [WinError 183] Impossibile creare un file, se il file esiste già: 'Message/Media/393471478055-1354147243@g.us/A'

"Impossibile creare un file, se il file esiste già" means: "Impossible to create a file, it already exists"

KnugiHK commented 2 years ago

Before you run the script, is "Message/Media/393471478055-1354147243@g.us/A" exist?

kintaro1981 commented 2 years ago

no, the working_wts directory is empty

KnugiHK commented 2 years ago

Could you try to add a condition and not os.path.isdir(destination) in to line 117 of extract_iphone_media.py and see if it works? From

if flags == 2:
    os.mkdir(destination)
elif flags == 1:
    shutil.copyfile(f"{base_dir}/{folder}/{hashes}", destination)

To

if flags == 2 and not os.path.isdir(destination):
    os.mkdir(destination)
elif flags == 1:
    shutil.copyfile(f"{base_dir}/{folder}/{hashes}", destination)
kintaro1981 commented 2 years ago

It worked. 👍

KnugiHK commented 2 years ago

Fixed. I will leave this open until next release.

KnugiHK commented 1 year ago

Released: https://github.com/KnugiHK/Whatsapp-Chat-Exporter/releases/tag/0.8.5