Title: Commented lines of code changing eel behavior (actually) · Issue #706 · python-eel/Eel · GitHub
Open Graph Title: Commented lines of code changing eel behavior (actually) · Issue #706 · python-eel/Eel
X Title: Commented lines of code changing eel behavior (actually) · Issue #706 · python-eel/Eel
Description: Eel version 0.16.0 Describe the bug Commented lines of code changes how Eel executes under very specific circumstances involving functions generated at runtime. These functions seem to require two eel.expose calls to be exposed properly,...
Open Graph Description: Eel version 0.16.0 Describe the bug Commented lines of code changes how Eel executes under very specific circumstances involving functions generated at runtime. These functions seem to require two ...
X Description: Eel version 0.16.0 Describe the bug Commented lines of code changes how Eel executes under very specific circumstances involving functions generated at runtime. These functions seem to require two ...
Opengraph URL: https://github.com/python-eel/Eel/issues/706
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Commented lines of code changing eel behavior (actually)","articleBody":"**Eel version**\r\n0.16.0\r\n**Describe the bug**\r\nCommented lines of code changes how Eel executes under very specific circumstances involving functions generated at runtime. These functions seem to require *two* eel.expose calls to be exposed properly, but only the first needs to execute. The second can be commented.\r\n\r\nI'm not sure if the code I'm writing should work or not, but it definitely shouldn't do this.\r\n\r\n**To Reproduce**\r\nSteps to reproduce the behavior:\r\n\r\ncreate a div like this:\r\n```html\r\n\u003cdiv class=\"div_class\" id=\"SomeDiv\">\r\n \u003cp>SomeDiv\u003c/p>\r\n\u003c/div>\r\n```\r\nand as many more of that class as you would like\r\n\r\nDefine functions in a loop like this:\r\n```javascript\r\nfor (const div of document.getElementsByClassName(\"div_class\")){\r\n funcName = div.id+\"Func\"\r\n window[funcName] = () => {\r\n console.log(\"In function\")\r\n }\r\n eel.expose(window[funcName], funcName)\r\n}\r\n//eel.expose(SomeDivFunc)\r\n```\r\nand call the function from Python.\r\nThis should work (it does for me).\r\n\r\nNow, remove the commented line.\r\n```javascript\r\nfor (const div of document.getElementsByClassName(\"div_class\")){\r\n funcName = div.id+\"Func\"\r\n window[funcName] = () => {\r\n console.log(\"In function\")\r\n }\r\n eel.expose(window[funcName], funcName)\r\n}\r\n```\r\n\r\nNow, eel fails to load the function, and we get \"module 'eel' has no attribute '\\\u003cname\\>'\".\r\n\r\nNow, if we uncomment that line, and comment or remove the first eel.expose:\r\n\r\n```javascript\r\nfor (const div of document.getElementsByClassName(\"div_class\")){\r\n funcName = div.id+\"Func\"\r\n window[funcName] = () => {\r\n console.log(\"In function\")\r\n }\r\n //eel.expose(window[funcName], funcName)\r\n}\r\neel.expose(SomeDivFunc)\r\n```\r\n\r\nThe app will execute, and the python call will not generate an error, but the function will not be executed.\r\n\r\n**Expected behavior**\r\nThe commented line should have no impact on code execution, as it is commented.\r\n\r\nAdditionally, it is strange that this functionality requires *both* of these eel.expose calls for the function to be exposed successfully. Neither expose alone works, but the second one can be commented and it will still work.\r\n\r\nIs this even supposed to work? It is a somewhat strange use-case.\r\n\r\n**System Information**\r\n - OS: Windows 11 x64\r\n - Browser: Chrome\r\n - Python Distribution: Python 3.11\r\n","author":{"url":"https://github.com/panthuncia","@type":"Person","name":"panthuncia"},"datePublished":"2023-10-11T07:03:18Z","url":"https://github.com/python-eel/Eel/issues/706"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| 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:1902026a-5dfe-f70a-05de-1e9a7cd52030 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | E816:4B7A6:FAFE:154AD:6AFDD51B |
| html-safe-nonce | 61757bb19213723fc9cbe96c28a505ff85bc4851859cfcf955909302e060bf55 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFODE2OjRCN0E2OkZBRkU6MTU0QUQ6NkFGREQ1MUIiLCJ2aXNpdG9yX2lkIjoiNzQ0NjQ3NjgwMDUxNjgwNTkxNiIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 26c328b03fc9bc8b16637420db7c04156c83ac2865de422deaa18e0b24cf97a7 |
| hovercard-subject-tag | issue:1937011267 |
| 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/python-eel/Eel/706/issue_layout |
| twitter:image | https://opengraph.githubassets.com/23cabefaa11ddd9f407fd831ccbfceb40a21f0c0d0ebb33f1a015eda7ef0b9fe/python-eel/Eel/issues/706 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/23cabefaa11ddd9f407fd831ccbfceb40a21f0c0d0ebb33f1a015eda7ef0b9fe/python-eel/Eel/issues/706 |
| og:image:alt | Eel version 0.16.0 Describe the bug Commented lines of code changes how Eel executes under very specific circumstances involving functions generated at runtime. These functions seem to require two ... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | panthuncia |
| hostname | github.com |
| expected-hostname | github.com |
| None | 9918bd4004419458bcd838065ac2a76b76ebd11705d73909fff5ab99e996fa23 |
| turbo-cache-control | no-preview |
| go-import | github.com/python-eel/Eel git https://github.com/python-eel/Eel.git |
| octolytics-dimension-user_id | 114726397 |
| octolytics-dimension-user_login | python-eel |
| octolytics-dimension-repository_id | 115559503 |
| octolytics-dimension-repository_nwo | python-eel/Eel |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 115559503 |
| octolytics-dimension-repository_network_root_nwo | python-eel/Eel |
| 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 | a231c174493a6a442c0b0544475c918b30128208 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width