'Same code does not work in venv despite installing dependencies from same requirements.txt

I am developing a web application and trying to migrate from Spyder to VS Code. It was working with the default interpreter, so I created a new venv but when I start the server it does not work with the same code that was working without the venv. Error description:

File "C:\Users\User\Desktop\Flask\app.py", line 77, in index
measurement_mx = rs.all()
AttributeError: 'ResultProxy' object has no attribute 'all' 

I installed exactly the same dependencies with pip install -r requirements.txt.

Can you help me what the solution could be, I could not find this problem unfortunately.

Relevant code snippet:

@app.route('/', methods=['POST', 'GET'])
def index():  
    with engine.connect() as con:
        rs = con.execute(SQL_string)
        measurement_mx = rs.all() #this is the error line
        measurement_list = []
        for row in measurement_mx:
            measurement_list.append(row._data)
        measurement_list = transpose(measurement_list)
    return render_template('index.html', measurement_list=measurement_list )

Thank you in advance!



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source