Category : python

I download a file from S3 like this: s3 = boto3.client(‘s3’) s3.download_file(‘testunzipping’,’DataPump_10000838.zip’,’/tmp/DataPump_10000838.zip’) For now it always works. However, I wanted to add some sort of error handling. How can I check or get an error message if the download fails. How would I know that there’s something wrong? Does boto3 offer any error handling functions? ..

Read more

I have a cart and a request handler that fires when the user clicks on ‘Add to cart’. @shop_blueprint.route(‘product_cart/<int:product_id>/add_on_cart’, methods=[‘GET’, ‘POST’]) def product_cart(product_id): product = services.get_product(product_id) if ‘cart’ in session: if not any(product.id in d for d in session[‘cart’]): session[‘cart’].append({product.id: 1}) elif any(product.id in d for d in session[‘cart’]): for d in session[‘cart’]: d.update((k, 1) ..

Read more

the plan is to make the user choose a file, and then save the filename in a variable that is callable from another python file. I’m a 12/10 newbie so pls dont be too harsh for obvious mistakes^^ Part where user chooses file and program should save the filename in variable(this .py file is named ..

Read more