0

I have been having problems with "buy" in pset7 for some time and am worried that pset7 will be my waterloo. So far, all I have done is check to see if there's enough cash and then calculated price to deduct amount. code is at https://pastebin.com/nFrEzFLh

This is my error from bottom portion of traceback. It appears the "int" object is not callable, but I don't know what that means in regards to my code:

File "/opt/pyenv/versions/3.6.0/lib/python3.6/site-packages/flask/app.py", line 1740, in make_response rv = self.response_class.force_type(rv, request.environ) File "/opt/pyenv/versions/3.6.0/lib/python3.6/site-packages/werkzeug/wrappers.py", line 885, in force_type response = BaseResponse(*_run_wsgi_app(response, environ)) [console ready]

dump() Local variables in frame

environ {'wsgi.version': (1, 0), 'wsgi.url_scheme': 'http', 'wsgi.input': <_io.BufferedReader name=-1>, 'wsgi.errors': , 'wsgi.multithread': True, 'wsgi.multiprocess': False, 'wsgi.run_once': False, 'werkzeug.server.shutdown': .shutdown_server at 0x7ff1ec14b840>, 'SERVER_SOFTWARE': 'Werkzeug/0.12.2', 'REQUEST_METHOD': 'POST', 'SCRIPT_NAME': '', 'PATH_INFO': '/buy', 'QUERY_STRING': '', 'REMOTE_ADDR': '10.240.1.15', 'REMOTE_PORT': 54714, 'SERVER_NAME': '0.0.0.0', 'SERVER_PORT': '8080', 'SERVER_PROTOCOL': 'HTTP/1.1', 'HTTP_HOST': 'ide50-kitseason.cs50.io:80', 'CONTENT_LENGTH': '19', 'HTTP_CACHE_CONTROL': 'max-age=0', 'HTTP_ORIGIN': 'http://ide50-kitseason.cs50.io', 'HTTP_UPGRADE_INSECURE_REQUESTS': '1', 'HTTP_USER_AGENT': 'Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, li , 'CONTENT_TYPE': 'application/x-www-form-urlencoded', 'HTTP_ACCEPT': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,/;q=0.8' , 'HTTP_REFERER': 'http://ide50-kitseason.cs50.io/buy', 'HTTP_ACCEPT_ENCODING': 'gzip, deflate', 'HTTP_ACCEPT_LANGUAGE': 'en-US,en;q=0.8', 'HTTP_COOKIE': 'ajs_anonymous_id=%2286c134ce-5e6d-4786-ae7c-db831a3f16f4%22; c9.live.p , 'HTTP_X_FORWARDED_PROTO': 'http', 'HTTP_X_FORWARDED_PORT': '80', 'HTTP_X_FORWARDED_FOR': '71.238.127.174', 'HTTP_CONNECTION': 'keep-alive', 'werkzeug.request': http://ide50-kitseason.cs50.io:80/buy' [POST]> } response
1 cls

File "/opt/pyenv/versions/3.6.0/lib/python3.6/site-packages/werkzeug/test.py", line 884, in run_wsgi_app app_rv = app(environ, start_response) [console ready] dump() Local variables in frame

start_response
.start_response at 0x7ff1ec14b7b8> buffered
False environ {'wsgi.version': (1, 0), 'wsgi.url_scheme': 'http', 'wsgi.input': <_io.BufferedReader name=-1>, 'wsgi.errors': , 'wsgi.multithread': True, 'wsgi.multiprocess': False, 'wsgi.run_once': False, 'werkzeug.server.shutdown': .shutdown_server at 0x7ff1ec14b840>, 'SERVER_SOFTWARE': 'Werkzeug/0.12.2', 'REQUEST_METHOD': 'POST', 'SCRIPT_NAME': '', 'PATH_INFO': '/buy', 'QUERY_STRING': '', 'REMOTE_ADDR': '10.240.1.15', 'REMOTE_PORT': 54714, 'SERVER_NAME': '0.0.0.0', 'SERVER_PORT': '8080', 'SERVER_PROTOCOL': 'HTTP/1.1', 'HTTP_HOST': 'ide50-kitseason.cs50.io:80', 'CONTENT_LENGTH': '19', 'HTTP_CACHE_CONTROL': 'max-age=0', 'HTTP_ORIGIN': 'http://ide50-kitseason.cs50.io', 'HTTP_UPGRADE_INSECURE_REQUESTS': '1', 'HTTP_USER_AGENT': 'Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.113 Safari/537.36' , 'CONTENT_TYPE': 'application/x-www-form-urlencoded', 'HTTP_ACCEPT': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image , 'HTTP_REFERER': 'http://ide50-kitseason.cs50.io/buy', 'HTTP_ACCEPT_ENCODING': 'gzip, deflate', 'HTTP_ACCEPT_LANGUAGE': 'en-US,en;q=0.8', 'HTTP_COOKIE': 'ajs_anonymous_id=%2286c134ce-5e6d-4786-ae7c-db831a3f16f4%22; c9.live.p , 'HTTP_X_FORWARDED_PROTO': 'http', 'HTTP_X_FORWARDED_PORT': '80', 'HTTP_X_FORWARDED_FOR': '71.238.127.174', 'HTTP_CONNECTION': 'keep-alive', 'werkzeug.request': http://ide50-kitseason.cs50.io:80/buy' [POST]> } app 1 response
[] buffer
[]

TypeError: 'int' object is not callable

0

"One of these things is not like the other". Notice how all the return statements "call" a function that will render another form/page. Except one, which returns an int. return order.

  • That makes complete sense. I was thinking that the amount needed to be passed on, but it doesn't work like C in this case. Now, I just need to get the rest of the code finished... – KitSeason Sep 5 '17 at 15:50

You must log in to answer this question.

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