Title: %magic% doesn't work in Emacs 25.1-2 ipython (run-python) buffer on Windows 7. · Issue #10211 · ipython/ipython · GitHub
Open Graph Title: %magic% doesn't work in Emacs 25.1-2 ipython (run-python) buffer on Windows 7. · Issue #10211 · ipython/ipython
X Title: %magic% doesn't work in Emacs 25.1-2 ipython (run-python) buffer on Windows 7. · Issue #10211 · ipython/ipython
Description: Programmer - normally I use ipython in emacs, in particular Ubuntu, but that machine is down for the count at the moment and so I'm, reluctantly, using windows and reconstructing the environment I like. Since there's a part not working t...
Open Graph Description: Programmer - normally I use ipython in emacs, in particular Ubuntu, but that machine is down for the count at the moment and so I'm, reluctantly, using windows and reconstructing the environment I ...
X Description: Programmer - normally I use ipython in emacs, in particular Ubuntu, but that machine is down for the count at the moment and so I'm, reluctantly, using windows and reconstructing the environmen...
Opengraph URL: https://github.com/ipython/ipython/issues/10211
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"%magic% doesn't work in Emacs 25.1-2 ipython (run-python) buffer on Windows 7.","articleBody":"Programmer - normally I use ipython in emacs, in particular Ubuntu, but that machine is down for the count at the moment and so I'm, reluctantly, using windows and reconstructing the environment I like. Since there's a part not working thought I might have a try at the code.\r\n\r\nIPython 5.1.0, Emacs 25.1-2 on Windows 7.\r\n\r\nI run %magic% and get this trace. (same operation in ipython in a cmd window works fine)\r\n\r\n```\r\n(Pdb) c\r\n\r\nBdbQuitTraceback (most recent call last)\r\n\u003cipython-input-6-d4375e0cd73a\u003e in \u003cmodule\u003e()\r\n----\u003e 1 get_ipython().magic(u'magic %')\r\n\r\nc:\\python27\\lib\\site-packages\\IPython\\core\\interactiveshell.pyc in magic(self, arg_s)\r\n 2156 magic_name, _, magic_arg_s = arg_s.partition(' ')\r\n 2157 magic_name = magic_name.lstrip(prefilter.ESC_MAGIC)\r\n-\u003e 2158 return self.run_line_magic(magic_name, magic_arg_s)\r\n 2159 \r\n 2160 #-------------------------------------------------------------------------\r\n\r\nc:\\python27\\lib\\site-packages\\IPython\\core\\interactiveshell.pyc in run_line_magic(self, magic_name, line)\r\n 2077 kwargs['local_ns'] = sys._getframe(stack_depth).f_locals\r\n 2078 with self.builtin_trap:\r\n-\u003e 2079 result = fn(*args,**kwargs)\r\n 2080 return result\r\n 2081 \r\n\r\n\u003cdecorator-gen-32\u003e in magic(self, parameter_s)\r\n\r\nc:\\python27\\lib\\site-packages\\IPython\\core\\magic.pyc in \u003clambda\u003e(f, *a, **k)\r\n 186 # but it's overkill for just that one bit of state.\r\n 187 def magic_deco(arg):\r\n--\u003e 188 call = lambda f, *a, **k: f(*a, **k)\r\n 189 \r\n 190 if callable(arg):\r\n\r\nc:\\python27\\lib\\site-packages\\IPython\\core\\magics\\basic.pyc in magic(self, parameter_s)\r\n 257 str(self.lsmagic()),\r\n 258 ]\r\n--\u003e 259 page.page('\\n'.join(out))\r\n 260 \r\n 261 \r\n\r\nc:\\python27\\lib\\site-packages\\IPython\\core\\page.py in page(data, start, screen_lines, pager_cmd)\r\n 273 \r\n 274 # fallback on default pager\r\n--\u003e 275 return pager_page(data, start, screen_lines, pager_cmd)\r\n 276 \r\n 277 \r\n\r\nc:\\python27\\lib\\site-packages\\IPython\\core\\page.py in pager_page(strng, start, screen_lines, pager_cmd)\r\n 186 numlines = max(num_newlines,int(len_str/80)+1)\r\n 187 pdb.set_trace()\r\n--\u003e 188 screen_lines_def = get_terminal_size()[1]\r\n 189 \r\n 190 # auto-determine screen size\r\n\r\nc:\\python27\\lib\\site-packages\\IPython\\core\\page.py in pager_page(strng, start, screen_lines, pager_cmd)\r\n 186 numlines = max(num_newlines,int(len_str/80)+1)\r\n 187 pdb.set_trace()\r\n--\u003e 188 screen_lines_def = get_terminal_size()[1]\r\n 189 \r\n 190 # auto-determine screen size\r\n\r\nc:\\python27\\lib\\bdb.pyc in trace_dispatch(self, frame, event, arg)\r\n 47 return # None\r\n 48 if event == 'line':\r\n---\u003e 49 return self.dispatch_line(frame)\r\n 50 if event == 'call':\r\n 51 return self.dispatch_call(frame, arg)\r\n\r\nc:\\python27\\lib\\bdb.pyc in dispatch_line(self, frame)\r\n 65 def dispatch_line(self, frame):\r\n 66 if self.stop_here(frame) or self.break_here(frame):\r\n---\u003e 67 self.user_line(frame)\r\n 68 if self.quitting: raise BdbQuit\r\n 69 return self.trace_dispatch\r\n\r\nBdbQuit: \r\n```\r\n\r\nIt's crashing basically because get_terminal_size isn't working - here:\r\n\r\n```\r\n def _get_terminal_size(fd):\r\n pdb.set_trace()\r\n columns = lines = 0\r\n\r\n try:\r\n handle = _handles[fd]\r\n csbi = create_string_buffer(22)\r\n res = windll.kernel32.GetConsoleScreenBufferInfo(handle, csbi)\r\n if res:\r\n res = struct.unpack(\"hhhhHhhhhhh\", csbi.raw)\r\n left, top, right, bottom = res[5:9]\r\n columns = right - left + 1\r\n lines = bottom - top + 1\r\n except Exception:\r\n pass\r\n```\r\n\r\nwindll.kernel32.GetConsoleScreenBufferInfo(handle, csbi) fails and returns 0. I can, later on, in pdb plug in a reasonable value for LINES and it works.\r\n\r\nWhat's needed to have a crack at this?","author":{"url":"https://github.com/patfla","@type":"Person","name":"patfla"},"datePublished":"2017-01-28T00:56:38.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":4},"url":"https://github.com/10211/ipython/issues/10211"}
| 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:91914ea0-53e4-f478-05cd-f099ab473e18 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | A53C:1A0CEA:B1C00B:F196C7:6A4C8FBD |
| html-safe-nonce | 1f21a3661352519ad386b3e672029f38460035b0b8fe21fa0370b9aa824524f0 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBNTNDOjFBMENFQTpCMUMwMEI6RjE5NkM3OjZBNEM4RkJEIiwidmlzaXRvcl9pZCI6IjY3MjM4Mzg1MzcwODk0NTQwMTMiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 5382673a579861ad97b360f8d301b7d0ed633c9574e453087b0c58315dc1b3fd |
| hovercard-subject-tag | issue:203775593 |
| 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/ipython/ipython/10211/issue_layout |
| twitter:image | https://opengraph.githubassets.com/885829aa67f060dbb530949a19e34851d8e150eac0b1c65d5039741b9069c767/ipython/ipython/issues/10211 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/885829aa67f060dbb530949a19e34851d8e150eac0b1c65d5039741b9069c767/ipython/ipython/issues/10211 |
| og:image:alt | Programmer - normally I use ipython in emacs, in particular Ubuntu, but that machine is down for the count at the moment and so I'm, reluctantly, using windows and reconstructing the environment I ... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | patfla |
| hostname | github.com |
| expected-hostname | github.com |
| None | 3d11bb817438277de2a940854450e83a7d32b6aeb5014e9e6b00a6423900251c |
| turbo-cache-control | no-preview |
| go-import | github.com/ipython/ipython git https://github.com/ipython/ipython.git |
| octolytics-dimension-user_id | 230453 |
| octolytics-dimension-user_login | ipython |
| octolytics-dimension-repository_id | 658518 |
| octolytics-dimension-repository_nwo | ipython/ipython |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 658518 |
| octolytics-dimension-repository_network_root_nwo | ipython/ipython |
| 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 | 7a2dede45637df6b92ddcfe2a557e67d4b5854ae |
| ui-target | canary-2 |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width