Closed niklasbuhl closed 3 years ago
Hi Niklas,
I just tried to reproduce your steps. Can you please execute the following in your CLI?
whatsapp-converter -h
so without python3
and without the .py
extension.
Is this the whole error message?
That worked perfectly! Thank you very much.
Yes that is everything.
This is strange. Is this an old pip installation? Did you try a pip update
?
pip update
doesn't work.
niklasbuhl@MacBook-Pro-2 Develop % pip update
ERROR: unknown command "update"
niklasbuhl@MacBook-Pro-2 Develop % pip
Usage:
pip <command> [options]
Commands:
install Install packages.
download Download packages.
uninstall Uninstall packages.
freeze Output installed packages in requirements format.
list List installed packages.
show Show information about installed packages.
check Verify installed packages have compatible dependencies.
config Manage local and global configuration.
search Search PyPI for packages.
cache Inspect and manage pip's wheel cache.
wheel Build wheels from your requirements.
hash Compute hashes of package archives.
completion A helper command used for command completion.
debug Show information useful for debugging.
help Show help for commands.
General Options:
-h, --help Show help.
--isolated Run pip in an isolated mode, ignoring environment variables and user configuration.
-v, --verbose Give more output. Option is additive, and can be used up to 3 times.
-V, --version Show version and exit.
-q, --quiet Give less output. Option is additive, and can be used up to 3 times (corresponding to WARNING, ERROR,
and CRITICAL logging levels).
--log <path> Path to a verbose appending log.
--no-input Disable prompting for input.
--proxy <proxy> Specify a proxy in the form [user:passwd@]proxy.server:port.
--retries <retries> Maximum number of retries each connection should attempt (default 5 times).
--timeout <sec> Set the socket timeout (default 15 seconds).
--exists-action <action> Default action when a path already exists: (s)witch, (i)gnore, (w)ipe, (b)ackup, (a)bort.
--trusted-host <hostname> Mark this host or host:port pair as trusted, even though it does not have valid or any HTTPS.
--cert <path> Path to alternate CA bundle.
--client-cert <path> Path to SSL client certificate, a single file containing the private key and the certificate in PEM
format.
--cache-dir <dir> Store the cache data in <dir>.
--no-cache-dir Disable the cache.
--disable-pip-version-check
Don't periodically check PyPI to determine whether a new version of pip is available for download.
Implied with --no-index.
--no-color Suppress colored output
--no-python-version-warning
Silence deprecation warnings for upcoming unsupported Pythons.
--use-feature <feature> Enable new functionality, that may be backward incompatible.
--use-deprecated <feature> Enable deprecated functionality, that will be removed in the future.
Also, found out my WhatsApp export file export lines like this: [10/01/2020, 00.07.04] Niklas: Hej Johnson!
.
Which I believe confuse your program? I've just setup GitHub, downloaded your code and will try to build on your program to make it also take the [
and ]
into consideration.
First about the square brackets. I will update the code and put the square brackets into the regular expression. I will commit the updated code on the weekend. I never saw this format before. Which country format or language did you configure for your phone?
I have added a pattern to match the square brackets and uploaded a new version, v0.4.1. The application should now correctly identify the format of your export. Can you please give it a try?
Thanks, tried it:
niklasbuhl@MacBook-Pro-2 Desktop % whatsapp-converter _chat.txt
Reading import file
Converting data now
0%| | 0/121 [00:00<?, ?it/s]10/01/2020
10/01/2020
13/01/2020
3%|██▋ | 4/121 [00:00<00:00, 1077.88it/s]
Traceback (most recent call last):
File "/usr/local/bin/whatsapp-converter", line 8, in <module>
sys.exit(main())
File "/usr/local/lib/python3.8/site-packages/whatsapp_converter/__main__.py", line 46, in main
whatsapp_converter.convert(args)
File "/usr/local/lib/python3.8/site-packages/whatsapp_converter/whatsapp_converter.py", line 183, in convert
buffer = parse(line, local_args)
File "/usr/local/lib/python3.8/site-packages/whatsapp_converter/whatsapp_converter.py", line 74, in parse
date = datetime.datetime.strptime(match.group(1), "%m/%d/%Y").date()
File "/usr/local/Cellar/python@3.8/3.8.5/Frameworks/Python.framework/Versions/3.8/lib/python3.8/_strptime.py", line 568, in _strptime_datetime
tt, fraction, gmtoff_fraction = _strptime(data_string, format)
File "/usr/local/Cellar/python@3.8/3.8.5/Frameworks/Python.framework/Versions/3.8/lib/python3.8/_strptime.py", line 349, in _strptime
raise ValueError("time data %r does not match format %r" %
ValueError: time data '13/01/2020' does not match format '%m/%d/%Y'
And this is some output from another file:
2020-09-27 2020-09-27|2020-09-27|2020-09-27||[12.03.2019 13.43.36] Niklas: Velkommen til!
From:
[12.03.2019 13.43.36] Niklas: Velkommen til!
Oh, okay. That is another format. Let me update the regex again. Thanks for sharing!
Can you please try again? I pushed v0.4.2 which solves the latest issue.
Almost works now - Still some issues:
Output:
2019-03-15 15:46 2019-03-15 15:46 James Nope de er ikke kommet endnu 🙄🤔
2019-03-15 15:46 2019-03-15 15:46 James [15.03.2019 15.49.28] James: video udeladt
2019-03-15 15:46 2019-03-15 15:46 James [15.03.2019 15.49.58] James: video udeladt
2019-03-15 15:46 2019-03-15 15:46 James [15.03.2019 15.57.56] Karen: video udeladt
2019-03-15 16:25 2019-03-15 16:25 James Det tager sin tid 😊
Input:
[15.03.2019 15.46.59] James: Nope de er ikke kommet endnu 🙄🤔
[15.03.2019 15.49.28] James: video udeladt
[15.03.2019 15.49.58] James: video udeladt
[15.03.2019 15.57.56] Karen: video udeladt
[15.03.2019 16.25.59] James: Det tager sin tid 😊
video udeladt
is video removed
so it seems like there's a problem when media is involved?
I see when I copy the example and run the code it works perfectly.
So I tried copying the entire conversation from one text document to another, then it seem to work perfectly. But when using the original document, something with the media causes the mistakes.
Possibly something with the line breaks or syntax from original .txt file?
I would need to get an original export from you. Can you create a sample conversation which fails and then attach the file to the issue?
Here's a file which causes errors.
Thank you very much. I am sorry, I was on vacation. I corrected the issue and uploaded v.0.4.3
Hi,
I tried using this library. I can't make it work with
python3
orpython
.Python 3 and pip3
With
python3
I managed to install the package through pip3 - butpython3 whatsapp-converter.py -h
doesn't work:/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.7/Resources/Python.app/Contents/MacOS/Python: can't open file 'whatsapp-converter.py': [Errno 2] No such file or directory
Using
pip3 list
I see thewhatsapp-converter
.I think it might have something to do with the system trying to use python 3.7 and homebrew install 3.8?
I'm using python3 and python through homebrew: https://docs.brew.sh/Homebrew-and-Python
Python and pip
With
python
andpip install whatsapp-converter
I can't even install the package: (from: https://pypi.org/project/whatsapp-converter/)And installed pip through the instruction from: https://pip.pypa.io/en/stable/installing/