Forums

Type error with dblquad function

I am encountering the following error when I execute the following dblquad function: "TypeError: <lambda>() takes 1 positional argument but 2 were given""

integr_trop,err = integrate.dblquad(transmit_energy,xmin,xmax,y_min,y_max,args=(z,),epsabs=1e-10)

Please see my full program at the following link: https://www.pythonanywhere.com/user/KenPryor67/shares/4f6b385baa7d47dca74e94e074307e0c

This code works and generates desired output with Anaconda/Spyder, but, produces the type error when executed in my PythonAnywhere console. Any insight into this issue would be greatly appreciated. Thanks in advance for your help!

My guess would be that the versions of Python, numpy, matplotlib and/or scipy are not the same. Specify your python version (eg python3.6) explicitly, and if the default numpy/matplotlib etc aren't the right version (see batteries included, it's probably worth switching to a virtualenv: http://help.pythonanywhere.com/pages/Virtualenvs

Harry, Thanks! Specifying the exact version of Python (3.6) fixed the problem, and now the program runs correctly and produces the desired output. This is good to know for future reference! As always, PythonAnywhere is an indispensable resource!

:-D