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

ValueError: could not convert string to float, on packet.sniff_time, when using use_ek=True #718

Open
tuokri opened this issue Nov 26, 2024 · 0 comments
Labels

Comments

@tuokri
Copy link

tuokri commented Nov 26, 2024

Describe the bug

Traceback (most recent call last):
  File "S:\PyCharmProjects\project\venv\Lib\site-packages\pyshark\packet\packet.py", line 87, in sniff_time
    timestamp = float(self.sniff_timestamp)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^
ValueError: could not convert string to float: '2024-11-25T13:45:37.622961000Z'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "S:\PyCharmProjects\project\project\analyze.py", line 467, in <module>
    main()
  File "S:\PyCharmProjects\project\project\analyze.py", line 327, in main
    if (start_date <= (sniff_time := packet.sniff_time.astimezone(dt.timezone.utc)) <= stop_date)
                                     ^^^^^^^^^^^^^^^^^
  File "S:\PyCharmProjects\project\venv\Lib\site-packages\pyshark\packet\packet.py", line 91, in sniff_time
    timestamp = float(self.sniff_timestamp.split(".")[0])
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ValueError: could not convert string to float: '2024-11-25T13:45:37'

To Reproduce
Try to use packet.sniff_time.

cap = pyshark.FileCapture(pcapng_path, use_ek=True, include_raw=False)
for packet in cap:
    print(packet.sniff_time)

Versions (please complete the following information):

  • OS: Windows 11
  • pyshark version: 0.6
  • tshark version: TShark (Wireshark) 4.4.2 (v4.4.2-0-g9947b17309f4).
@tuokri tuokri added the bug label Nov 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant