Title: undefined symbol: iptc_init (libiptc compatibilitly) · Issue #5 · ldx/python-iptables · GitHub
Open Graph Title: undefined symbol: iptc_init (libiptc compatibilitly) · Issue #5 · ldx/python-iptables
X Title: undefined symbol: iptc_init (libiptc compatibilitly) · Issue #5 · ldx/python-iptables
Description: If libip4tc doesn't exist but libiptc does the module failes to load with the following error: Traceback (most recent call last): File "comment.py", line 3, in
Open Graph Description: If libip4tc doesn't exist but libiptc does the module failes to load with the following error: Traceback (most recent call last): File "comment.py", line 3, in
X Description: If libip4tc doesn't exist but libiptc does the module failes to load with the following error: Traceback (most recent call last): File "comment.py", line 3, in <module> import i...
Opengraph URL: https://github.com/ldx/python-iptables/issues/5
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"undefined symbol: iptc_init (libiptc compatibilitly)","articleBody":"If libip4tc doesn't exist but libiptc does the module failes to load with the following error:\n\n```\nTraceback (most recent call last): \n File \"comment.py\", line 3, in \u003cmodule\u003e \n import iptc \n File \"/usr/lib/pymodules/python2.6/iptc/__init__.py\", line 110, in \u003cmodule\u003e \n class iptc(object): \n File \"/usr/lib/pymodules/python2.6/iptc/__init__.py\", line 112, in iptc \n iptc_init = _libiptc.iptc_init \n File \"/usr/lib/python2.6/ctypes/__init__.py\", line 366, in __getattr__ \n func = self.__getitem__(name) \n File \"/usr/lib/python2.6/ctypes/__init__.py\", line 371, in __getitem__ \n func = self._FuncPtr((name_or_ordinal, self)) \nAttributeError: python: undefined symbol: iptc_init\n```\n\nSeems like ctypes.CDLL() doesn't throw an exception in case the lib couldn't be loaded.\n\nFollwoing change should fix the problem:\n\n```\ndiff --git a/iptc/__init__.py b/iptc/__init__.py\nindex 400111c..3d25f29 100644\n--- a/iptc/__init__.py\n+++ b/iptc/__init__.py\n@@ -102,10 +102,15 @@ class ipt_entry_match(xt_entry_match):\n\n ipt_align = xt_align\n\n-try:\n- _libiptc = ct.CDLL(ctypes.util.find_library(\"ip4tc\"), use_errno = True)\n-except:\n- _libiptc = ct.CDLL(ctypes.util.find_library(\"iptc\"), use_errno = True)\n+_libiptc_file = ctypes.util.find_library(\"ip4tc\")\n+\n+if not _libiptc_file:\n+ _libiptc_file = ctypes.util.find_library(\"iptc\")\n+\n+if not _libiptc_file:\n+ raise IPTCError(\"error: libiptc/libip4tc not found\")\n+\n+_libiptc = ct.CDLL(_libiptc_file, use_errno = True)\n\n class iptc(object):\n \"\"\"This class contains all libiptc API calls.\"\"\"\n```\n","author":{"url":"https://github.com/freddy36","@type":"Person","name":"freddy36"},"datePublished":"2012-05-07T10:18:24.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":1},"url":"https://github.com/5/python-iptables/issues/5"}
| 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:e9ee5771-1fb7-1707-169f-e630342c959e |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | D27E:3B0A26:5777B:77DE3:6A5E1E63 |
| html-safe-nonce | f168913d43407924a63608ef25e4a24d3776f541d8c99661d3418d5959a0c4c7 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEMjdFOjNCMEEyNjo1Nzc3Qjo3N0RFMzo2QTVFMUU2MyIsInZpc2l0b3JfaWQiOiIzMDQ0NTg2MTg2Mjk4MjM2NTE1IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 35a29dd88db33d8162d0c9e03d7b8469a3cb3326100c58da0426ad3d16996258 |
| hovercard-subject-tag | issue:4451593 |
| 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/ldx/python-iptables/5/issue_layout |
| twitter:image | https://opengraph.githubassets.com/eab32ce32b83e53f486d54e46a3fb3658e49610360e9b2d19d78ffe0d8c68853/ldx/python-iptables/issues/5 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/eab32ce32b83e53f486d54e46a3fb3658e49610360e9b2d19d78ffe0d8c68853/ldx/python-iptables/issues/5 |
| og:image:alt | If libip4tc doesn't exist but libiptc does the module failes to load with the following error: Traceback (most recent call last): File "comment.py", line 3, in |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | freddy36 |
| hostname | github.com |
| expected-hostname | github.com |
| None | 7a60e060dad2c24f72179d36247204b454da37845d1728020cd42046a433f87f |
| turbo-cache-control | no-preview |
| go-import | github.com/ldx/python-iptables git https://github.com/ldx/python-iptables.git |
| octolytics-dimension-user_id | 456904 |
| octolytics-dimension-user_login | ldx |
| octolytics-dimension-repository_id | 1032167 |
| octolytics-dimension-repository_nwo | ldx/python-iptables |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 1032167 |
| octolytics-dimension-repository_network_root_nwo | ldx/python-iptables |
| 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 | 0ae7f3ea7b1bb2f1f4623bb093bbf54cee05d830 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width