0

I recently migrated my 2018 CS50 files from c9.io to AWS Cloud9, including my end of course project, which happens to borrow heavily from the CS50 Finance project. I am simply trying to re-run my 2018 files into the new environment. To make the files run in AWS Cloud9, I had to re-install some module in the new environment, but eventually running into the following error when running one of the file, which is meant to upload a bunch of eligible stock tickers from Quandl:

My code:

import quandl, requests from flask import request, current_app from cs50 import SQL db = SQL("sqlite:///formula.db")

db.execute("DELETE FROM coverage") """feedback = requests.get(f"https://www.quandl.com/api/v3/datatables/SHARADAR/SF1.json?ticker={ticker}&qopts.columns=ticker,dimension,datekey,revenue&api_key=rCmomCxddWF7R8bj4xMu")""" """changes to below line from project.new: remove "f" """ feedback = requests.get("https://www.quandl.com/api/v3/datatables/SHARADAR/TICKERS.json?table=SF1&qopts.columns=ticker,name,exchange,isdelisted,category,cusips,siccode,sicsector,sicindustry,famaindustry,sector,industry,scalemarketcap,scalerevenue,currency,location,lastupdated&api_key=rCmomCxddWF7R8bj4xMu") responses = feedback.json() data = responses['datatable']['data'] if not data: db.execute("INSERT INTO test(ticker,calendardate,datekey,reportperiod,lastupdated,cashnequsd,debtusd,ebitusd,fcf,ppnenet,workingcapital,shareswa,de,ebitdausd) VALUES(:ticker,:calendardate,:datekey,:reportperiod,:lastupdated,:cashnequsd,:debtusd,:ebitusd,:fcf,:ppnenet,:workingcapital,:shareswa,:de,:ebitdausd)", ticker='N/A', calendardate='N/A', datekey='N/A', reportperiod='N/A', lastupdated='N/A', cashnequsd='N/A', debtusd='N/A', ebitusd='N/A', fcf='N/A', ppnenet='N/A', workingcapital='N/A', shareswa='N/A', de='N/A', ebitdausd='N/A') elif data == 'NULL': db.execute("INSERT INTO test(ticker,calendardate,datekey,reportperiod,lastupdated,cashnequsd,debtusd,ebitusd,fcf,ppnenet,workingcapital,shareswa,de,ebitdausd) VALUES(:ticker,:calendardate,:datekey,:reportperiod,:lastupdated,:cashnequsd,:debtusd,:ebitusd,:fcf,:ppnenet,:workingcapital,:shareswa,:de,:ebitdausd)", ticker='N/A', calendardate='N/A', datekey='N/A', reportperiod='N/A', lastupdated='N/A', cashnequsd='N/A', debtusd='N/A', ebitusd='N/A', fcf='N/A', ppnenet='N/A', workingcapital='N/A', shareswa='N/A', de='N/A', ebitdausd='N/A') else: for record in data: ticker,name,exchange,isdelisted,category,cusips,siccode,sicsector,sicindustry,famaindustry,sector,industry,scalemarketcap,scalerevenue,currency,location,lastupdated = record db.execute("INSERT INTO coverage(ticker,name,exchange,isdelisted,category,cusips,siccode,sicsector,sicindustry,famaindustry,sector,industry,scalemarketcap,scalerevenue,currency,location,lastupdated) VALUES(:ticker,:name,:exchange,:isdelisted,:category,:cusips,:siccode,:sicsector,:sicindustry,:famaindustry,:sector,:industry,:scalemarketcap,:scalerevenue,:currency,:location,:lastupdated)", ticker=ticker, name=name, exchange=exchange, isdelisted=isdelisted ,category=category, cusips=cusips, siccode=siccode, sicsector=sicsector, sicindustry=sicindustry, famaindustry=famaindustry, sector=sector, industry=industry, scalemarketcap=scalemarketcap, scalerevenue=scalerevenue, currency=currency, location=location, lastupdated=lastupdated)

Error displayed:

Traceback (most recent call last): File "ticker.py", line 6, in db = SQL("sqlite:///formula.db") File "/home/ubuntu/.local/lib/python2.7/site-packages/cs50/sql.py", line 66, in init self.execute("SELECT 1") File "/home/ubuntu/.local/lib/python2.7/site-packages/cs50/flask.py", line 37, in _execute_after if flask.current_app: AttributeError: 'module' object has no attribute 'current_app'

I then opened the last file mentioned ("/home/ubuntu/.local/lib/python2.7/site-packages/cs50/flask.py"), not one i created nor saved on my environment -- guessing it is cs50 library material -- and noticed bunch of lines are flagging modules error, including the current_app one.

Any idea what's going on with the new AWS Cloud9 environment? My sense is there are modules version/out of sync between c9.io and the new IDE. thanks for the help. I'm just trying to re-run files that were fine in c9.io into AWS Cloud9.

thanks

1 Answer 1

1

This was a bug in the CS50 python library which was fixed today. Please restart the cs50 IDE and try again.

4
  • Thank you for the comment. I tried but same behavior. I could be wrong but i am guessing it is due to "An AWS Cloud9 version of the CS50 IDE is not yet available" according to the migration docs. But at the same time, why would they force a migration if not ready. Something does not make sense.
    – MikaelH
    Commented Jul 11, 2019 at 13:29
  • I tried to run the 2018 cs50 pset7 finance files in the new AWS Cloud9, and getting multitude of syntax errors, so I am guessing there are compatibility issues between AWS Cloud9 and the old c9.io, as files used to run fine in c9.io
    – MikaelH
    Commented Jul 11, 2019 at 14:39
  • The new ide is ide.cs50.io Are you sure that is where you are running your code? You should have received an email with these instructions: cs50.readthedocs.io/ide/migrate
    – curiouskiwi
    Commented Jul 11, 2019 at 20:59
  • no, it's not where i was running things :( I got another email and was told to create a new Cloud9 environment directly with AWS. That likely explains the issue. Thank you
    – MikaelH
    Commented Jul 11, 2019 at 22:11

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .