Jupyter Notebook with Python 3.8 – NotImplementedError

EDIT This issue exists in older versions of Jupyter Notebook and was fixed in version 6.0.3 (released 2020-01-21). To upgrade to the latest version run: pip install notebook –upgrade Following on this issue through GitHub, it seems the problem is related to the tornado server that jupyter uses. For those that can’t wait for an … Read more

How can I periodically execute a function with asyncio?

For Python versions below 3.5: import asyncio @asyncio.coroutine def periodic(): while True: print(‘periodic’) yield from asyncio.sleep(1) def stop(): task.cancel() loop = asyncio.get_event_loop() loop.call_later(5, stop) task = loop.create_task(periodic()) try: loop.run_until_complete(task) except asyncio.CancelledError: pass For Python 3.5 and above: import asyncio async def periodic(): while True: print(‘periodic’) await asyncio.sleep(1) def stop(): task.cancel() loop = asyncio.get_event_loop() loop.call_later(5, stop) … Read more

Is JSON Hijacking still an issue in modern browsers?

No, it is no longer possible to capture values passed to the [] or {} constructors in Firefox 21, Chrome 27, or IE 10. Here’s a little test page, based on the main attacks described in http://www.thespanner.co.uk/2011/05/30/json-hijacking/: (http://jsfiddle.net/ph3Uv/2/) var capture = function() { var ta = document.querySelector(‘textarea’) ta.innerHTML = ”; ta.appendChild(document.createTextNode(“Captured: “+JSON.stringify(arguments))); return arguments; } … Read more