Skip to content

Using Flask with sagemath #35051

@Eloitor

Description

@Eloitor

Is there an existing issue for this?

  • I have searched the existing issues for a bug report that matches the one I want to file, without success.

Did you read the documentation and troubleshoot guide?

  • I have read the documentation and troubleshoot guide

Environment

- **OS**: Void Linux x86_64-glibc
- **Sage Version**: version 9.7, Release Date: 2022-09-19

Steps To Reproduce

  1. Install Flask
  2. Create this example file
from flask import Flask

app = Flask(__name__)

@app.route('/')
def index():
    F = NumberField(x**2-x-1, name='w')
    w = F.gen()
    I = Ideal(F, 1)
    print(F)        # This is fine
    print(I)        # This gives an error
    
    return F.__str__()

if __name__ == '__main__':
    app.run()
  1. run this file with sagemath, and access http://127.0.0.1:5000/ on a browser

Expected Behavior

The field and the ideal are printed in the terminal. The field is shown in the browser.

Actual Behavior

The field is printed in the terminal, but then an error occurs.

This is the output of sage test_flask.sage &> output.txt:

output.txt

Additional Information

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions