Title: RecursionError when unpickling message object · Issue #804 · hardbyte/python-can · GitHub
Open Graph Title: RecursionError when unpickling message object · Issue #804 · hardbyte/python-can
X Title: RecursionError when unpickling message object · Issue #804 · hardbyte/python-can
Description: Python 3.7.5 python-can 3.3.2 To hand over messages to another process I intended to use multiprocessing.JoinableQueue. I stumbled over a RecursionError and tracked it down to the pickleing that is used to serialize the objects (see exam...
Open Graph Description: Python 3.7.5 python-can 3.3.2 To hand over messages to another process I intended to use multiprocessing.JoinableQueue. I stumbled over a RecursionError and tracked it down to the pickleing that is...
X Description: Python 3.7.5 python-can 3.3.2 To hand over messages to another process I intended to use multiprocessing.JoinableQueue. I stumbled over a RecursionError and tracked it down to the pickleing that is...
Opengraph URL: https://github.com/hardbyte/python-can/issues/804
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"RecursionError when unpickling message object","articleBody":"Python 3.7.5\r\npython-can 3.3.2\r\n\r\nTo hand over messages to another process I intended to use multiprocessing.JoinableQueue.\r\nI stumbled over a RecursionError and tracked it down to the pickleing that is used to serialize the objects (see example code).\r\n\r\nThe error occurs when calling loads() on the serialized message.\r\n\r\nI'm not a python expert and found some clues regarding the \\_\\_getattr\\_\\_ method. Maybe a custom \\_\\_getattr\\_\\_ method is needed for the message objects?\r\n\r\nIs there another way to hand over the emssage objects to another process?\r\n\r\n~~~\r\n#!/usr/bin/env python3\r\nimport can\r\nimport logging\r\nimport pickle\r\n\r\nclass CanReader():\r\n \"\"\"\r\n Reads messages from a configured can bus and puts them into a queue for further processing\r\n \"\"\"\r\n\r\n def __init__(self):\r\n LOG_FORMAT = '%(asctime)s:%(threadName)s:%(levelname)s: %(message)s'\r\n logging.basicConfig(format=LOG_FORMAT, level=logging.INFO)\r\n\r\n\r\n def run(self):\r\n can.rc['interface'] = 'socketcan_ctypes'\r\n can.rc['channel'] = \"vcan0\"\r\n\r\n can_bus = can.interface.Bus()\r\n\r\n try:\r\n for can_msg in can_bus:\r\n if can_msg is None:\r\n continue\r\n\r\n pick = pickle.dumps(can_msg)\r\n logging.info(\"pickled\")\r\n unpick = pickle.loads(pick)\r\n logging.info(\"unpickled\")\r\n\r\n except KeyboardInterrupt:\r\n logging.error(\"KeyboardInterrupt - Stopping CanReader\")\r\n\r\n return\r\n\r\nif __name__ == \"__main__\":\r\n canReader = CanReader()\r\n canReader.run()\r\n~~~\r\n\r\n\r\nConsole output:\r\n~~~\r\n/usr/bin/python3.7 /XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/SerializationTest.py\r\n2020-04-02 13:35:59,352:MainThread:INFO: Created a socket\r\n2020-04-02 13:35:59,389:MainThread:INFO: pickled\r\nTraceback (most recent call last):\r\n File \"/XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/SerializationTest.py\", line 39, in \u003cmodule\u003e\r\n canReader.run()\r\n File \"/XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/SerializationTest.py\", line 29, in run\r\n unpick = pickle.loads(pick)\r\n File \"/home/XXXXXX/.local/lib/python3.7/site-packages/can/message.py\", line 59, in __getattr__\r\n return self._dict[key]\r\n File \"/home/XXXXXX/.local/lib/python3.7/site-packages/can/message.py\", line 59, in __getattr__\r\n return self._dict[key]\r\n File \"/home/XXXXXX/.local/lib/python3.7/site-packages/can/message.py\", line 59, in __getattr__\r\n return self._dict[key]\r\n [Previous line repeated 494 more times]\r\n File \"/home/XXXXXX/.local/lib/python3.7/site-packages/can/message.py\", line 58, in __getattr__\r\n warnings.warn(\"Custom attributes of messages are deprecated and will be removed in 4.0\", DeprecationWarning)\r\nRecursionError: maximum recursion depth exceeded while calling a Python object\r\n\r\nProcess finished with exit code 1\r\n~~~","author":{"url":"https://github.com/fpetry","@type":"Person","name":"fpetry"},"datePublished":"2020-04-02T11:46:28.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":2},"url":"https://github.com/804/python-can/issues/804"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:5e9a1287-b0e4-841b-aa03-c11dec37fb0f |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 8D60:4FFB3:443A38:5D965F:6A61772B |
| html-safe-nonce | dfc9463ba77fd4e3373fb4a70b8cbb9771df714cad459432648112149b29b520 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4RDYwOjRGRkIzOjQ0M0EzODo1RDk2NUY6NkE2MTc3MkIiLCJ2aXNpdG9yX2lkIjoiNzU4OTYyOTY4Mjg2Mjk1ODUxIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | dbd18275912376db824e9f3448102ec63446f8da37698d87df1eb356aa8d088f |
| hovercard-subject-tag | issue:592569105 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/hardbyte/python-can/804/issue_layout |
| twitter:image | https://opengraph.githubassets.com/3d752cdd87060812a5a1b2de256ad9d389c6bff20594d4d9f1b375ff65ee0ebe/hardbyte/python-can/issues/804 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/3d752cdd87060812a5a1b2de256ad9d389c6bff20594d4d9f1b375ff65ee0ebe/hardbyte/python-can/issues/804 |
| og:image:alt | Python 3.7.5 python-can 3.3.2 To hand over messages to another process I intended to use multiprocessing.JoinableQueue. I stumbled over a RecursionError and tracked it down to the pickleing that is... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | fpetry |
| hostname | github.com |
| expected-hostname | github.com |
| None | b05bb6314e7e93021a7b7dab54a85cbe48d821938e762c1dff815efd60699622 |
| turbo-cache-control | no-preview |
| go-import | github.com/hardbyte/python-can git https://github.com/hardbyte/python-can.git |
| octolytics-dimension-user_id | 855189 |
| octolytics-dimension-user_login | hardbyte |
| octolytics-dimension-repository_id | 69090889 |
| octolytics-dimension-repository_nwo | hardbyte/python-can |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 69090889 |
| octolytics-dimension-repository_network_root_nwo | hardbyte/python-can |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 94389bfdcd393b0a5a274aee94e8a9739d063fe5 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width