Python for Everybody - Interactive Activecode Execution Error
- What Task are you trying to accomplish?
- In 16.4. Starting with programs, the second active code (Activity: 16.4.2 ActiveCode (urllinksparser)) the following error message is displayed:
Traceback (most recent call last):
File "test.py", line 10, in
url = input('Enter - ')
EOFError: EOF when reading a line
- What steps did you take to try to accomplish that task?
- Clicked on the Save & Run button
- Specifically what went wrong?
- Here's the output from the JavaScript Console:
activecode.js:285 adding click function for run
pretext.js:25 setting up pretext
activecode.js:1287 starting runProg
activecode.js:592 before get hist
activecode.js:634 making a new scrubber
runestonebase.js:214 running {"div_id":"startingprograms_elev","code":"usf = input('Enter the US Floor Number: ')\nwf = int(usf) - 1\nprint('Non-US Floor Number is',wf)\n","language":"python","errinfo":"success","to_save":"False","prefix":"","partner":"","course":"cmsc191","clientLoginStatus":true,"timezoneoffset":4}
activecode.js:592 before get hist
activecode.js:634 making a new scrubber
runestonebase.js:214 running {"div_id":"urllinksparser","code":"import urllib.request, urllib.parse, urllib.error\nfrom bs4 import BeautifulSoup\nimport ssl\n\n# Ignore SSL certificate errors\nctx = ssl.create_default_context()\nctx.check_hostname = False\nctx.verify_mode = ssl.CERT_NONE\n\nurl = input('Enter - ')\nhtml = urllib.request.urlopen(url, context=ctx).read()\nsoup = BeautifulSoup(html, 'html.parser')\n\n# Retrieve all of the anchor tags\ntags = soup('a')\nfor tag in tags:\n print(tag.get('href', None))\n","language":"python3","errinfo":12,"to_save":"False","prefix":"","partner":"","course":"cmsc191","clientLoginStatus":true,"timezoneoffset":4}
- What course are you in?
- cmsc191
- What is your username?
- DebMDuke
- What page of the course?
- 16.4. Starting with programs
- Specifically what exercise does not work?
- Activity: 16.4.2 ActiveCode (urllinksparser)
- What browser are you using? What version of the browser?
- Chrome; Version 100.0.4896.88 (Official Build) (x86_64)
I can see that this example uses BeautifulSoup which means it is not running in the browser. Python programs that run on our sandboxed server cannot do interactive input. Maybe you can get by this error for the moment by hardcoding what you would have typed in as a result of the input.
@barbarer
Stale issue message
I changed the example to use an URL rather than ask for one.