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

Issue with ValueError time data does not match format #9

Closed
PsEHAmfxXNKzrgwT opened this issue Sep 20, 2016 · 5 comments
Closed

Issue with ValueError time data does not match format #9

PsEHAmfxXNKzrgwT opened this issue Sep 20, 2016 · 5 comments

Comments

@PsEHAmfxXNKzrgwT
Copy link

``C:\Users\*REDACTED*\Documents\Powershell\messages\all>fbcap ./messages.htm
Discovered chat thread with [*REDACTED*, *REDACTED*]...Traceback (most recent call last):
  File "C:\Users\*REDACTED*\AppData\Local\Programs\Python\Python35-32\Scripts\fbcap-script.py", line 9, in <module>
    load_entry_point('fbchat-archive-parser==0.7.post2', 'console_scripts', 'fbcap')()
  File "c:\users\*REDACTED*\appdata\local\programs\python\python35-32\lib\site-packages\fbchat_archive_parser\main.py", line 137, in main
    app.run()
  File "c:\users\*REDACTED*\appdata\local\programs\python\python35-32\lib\site-packages\clip.py", line 652, in run
    self.invoke(self.parse(tokens))
  File "c:\users\*REDACTED*\appdata\local\programs\python\python35-32\lib\site-packages\clip.py", line 634, in invoke
    self._main.invoke(parsed)
  File "c:\users\*REDACTED*\appdata\local\programs\python\python35-32\lib\site-packages\clip.py", line 519, in invoke
    self._callback(**{k: v for k, v in iteritems(parsed) if k not in self._subcommands})
  File "c:\users\*REDACTED*\appdata\local\programs\python\python35-32\lib\site-packages\fbchat_archive_parser\main.py", line 87, in fbcap
    raise e
  File "c:\users\*REDACTED*\appdata\local\programs\python\python35-32\lib\site-packages\fbchat_archive_parser\main.py", line 70, in fbcap
    fbch = parse_data(parser_call)
  File "c:\users\*REDACTED*\appdata\local\programs\python\python35-32\lib\site-packages\fbchat_archive_parser\main.py", line 92, in parse_data
    return parser_call()
  File "c:\users\*REDACTED*\appdata\local\programs\python\python35-32\lib\site-packages\fbchat_archive_parser\parser.py", line 124, in __init__
    self._parse_content(bs4)
  File "c:\users\*REDACTED*\appdata\local\programs\python\python35-32\lib\site-packages\fbchat_archive_parser\parser.py", line 146, in _parse_content
    self._process_element(pos, element)
  File "c:\users\*REDACTED*\appdata\local\programs\python\python35-32\lib\site-packages\fbchat_archive_parser\parser.py", line 325, in _process_element
    self._parse_time(e)
  File "c:\users\*REDACTED*\appdata\local\programs\python\python35-32\lib\site-packages\fbchat_archive_parser\parser.py", line 242, in _parse_time
    timestamp = datetime.strptime(timestamp, self._DATE_FORMAT)
  File "c:\users\*REDACTED*\appdata\local\programs\python\python35-32\lib\_strptime.py", line 510, in _strptime_datetime
    tt, fraction = _strptime(data_string, format)
  File "c:\users\*REDACTED*\appdata\local\programs\python\python35-32\lib\_strptime.py", line 343, in _strptime
    (data_string, format))
ValueError: time data 'Saturday, 9 July 2016 at 21:50' does not match format '%A, %B %d, %Y at %I:%M%p'
@PsEHAmfxXNKzrgwT
Copy link
Author

Error when trying to use "fbcap ./messages.htm"

Windows 10 64Bit, Python35-32

@ownaginatious
Copy link
Owner

Hi there, thanks for reporting this issue!

I believe the issue was caused by the fact that I only expected 12-hour formatted time stamps. I modified it to also support 24-hour time stamps, like in your example.

Please try the new version 0.7.post5 and respond to this ticket if you're still having issues.

@PsEHAmfxXNKzrgwT
Copy link
Author

Hi there. That seems to have worked fine. However when the script comes across an emoji like this:

It is throwing this error.

[2016-06-19 07:32Z] Logan Westbury: Traceback (most recent call last): File "C:\Users\Logan\AppData\Local\Programs\Python\Python35-32\Scripts\fbcap-script.py", line 9, in <module> load_entry_point('fbchat-archive-parser==0.7.post5', 'console_scripts', 'fbcap')() File "c:\users\logan\appdata\local\programs\python\python35-32\lib\site-packages\fbchat_archive_parser\main.py", line 142, in main app.run() File "c:\users\logan\appdata\local\programs\python\python35-32\lib\site-packages\clip.py", line 652, in run self.invoke(self.parse(tokens)) File "c:\users\logan\appdata\local\programs\python\python35-32\lib\site-packages\clip.py", line 634, in invoke self._main.invoke(parsed) File "c:\users\logan\appdata\local\programs\python\python35-32\lib\site-packages\clip.py", line 519, in invoke self._callback(**{k: v for k, v in iteritems(parsed) if k not in self._subcommands}) File "c:\users\logan\appdata\local\programs\python\python35-32\lib\site-packages\fbchat_archive_parser\main.py", line 87, in fbcap raise e File "c:\users\logan\appdata\local\programs\python\python35-32\lib\site-packages\fbchat_archive_parser\main.py", line 80, in fbcap write(format, fbch) File "c:\users\logan\appdata\local\programs\python\python35-32\lib\site-packages\fbchat_archive_parser\writers\__init_ _.py", line 18, in write item().write(data) File "c:\users\logan\appdata\local\programs\python\python35-32\lib\site-packages\fbchat_archive_parser\writers\writer. py", line 14, in write return self.write_history(data) File "c:\users\logan\appdata\local\programs\python\python35-32\lib\site-packages\fbchat_archive_parser\writers\text.py ", line 30, in write_history self.write_thread(history.chat_threads[k], stream) File "c:\users\logan\appdata\local\programs\python\python35-32\lib\site-packages\fbchat_archive_parser\writers\text.py ", line 40, in write_thread self.write_message(message, stream) File "c:\users\logan\appdata\local\programs\python\python35-32\lib\site-packages\fbchat_archive_parser\writers\text.py ", line 51, in write_message stream.write('%s\n' % lines[0]) File "c:\users\logan\appdata\local\programs\python\python35-32\lib\site-packages\colorama\ansitowin32.py", line 40, in write self.__convertor.write(text) File "c:\users\logan\appdata\local\programs\python\python35-32\lib\site-packages\colorama\ansitowin32.py", line 141, i n write self.write_and_convert(text) File "c:\users\logan\appdata\local\programs\python\python35-32\lib\site-packages\colorama\ansitowin32.py", line 169, i n write_and_convert self.write_plain_text(text, cursor, len(text)) File "c:\users\logan\appdata\local\programs\python\python35-32\lib\site-packages\colorama\ansitowin32.py", line 174, i n write_plain_text self.wrapped.write(text[start:end]) File "c:\users\logan\appdata\local\programs\python\python35-32\lib\encodings\cp850.py", line 19, in encode return codecs.charmap_encode(input,self.errors,encoding_map)[0] UnicodeEncodeError: 'charmap' codec can't encode characters in position 16-17: character maps to <undefined>

Attached is a screenshot from Facebook of the message right after the last one displayed. Also attached is a screenshot of the console.

firefox_2016-09-21_17-36-49

powershell_2016-09-21_17-38-00

@ownaginatious
Copy link
Owner

ownaginatious commented Sep 21, 2016

Hey there. Weird... that isn't supposed to be an issue under Python 3, which I see you're using. Could be a Windows-specific issue. I've added a patch that should correct the behaviour (0.7post6).

Please let me know if that helps.

EDIT: Whoops, had a bug in that version. Try 0.7post7 instead.

@PsEHAmfxXNKzrgwT
Copy link
Author

That is working perfectly. Thank you very much!

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

2 participants