web2py / py4web-example-apps

2 stars 3 forks source link

databases folder missing for the example app todo #1

Open andreaschizzali opened 4 months ago

andreaschizzali commented 4 months ago

By running the py4web-example-apps I get the following error message for the todo app: FileNotFoundError: [Errno 2] No such file or directory: 'C:\\github\\py4web-example-apps\\apps\\todo\\databases\\sql.log' The app todo is minimalistic, there is only init.py with

        db = DAL(
            "sqlite://storage.db", folder=os.path.join(os.path.dirname(__file__), "databases")
        )
        db.define_table("todo", Field("info"))
        db.commit()

In a new Installation the folder "databases" ist not present. Perheaps the issue can be solved so:

from py4web.core import required_folder
db = DAL(
    "sqlite://storage.db", folder=required_folder(os.path.dirname(__file__), "databases")
)
db.define_table("todo", Field("info"))
db.commit()
mdipierro commented 4 months ago

good catch!

On Wed, Jul 10, 2024, 23:15 Andreas Chizzali @.***> wrote:

By running the py4web-example-apps I get the following error message for the todo app: FileNotFoundError: [Errno 2] No such file or directory: 'C:\github\py4web-example-apps\apps\todo\databases\sql.log' The app todo is minimalistic, there is only init.py with


db = DAL(
"sqlite://storage.db", folder=os.path.join(os.path.dirname(*file*),
"databases")
)
db.define_table("todo", Field("info"))
db.commit()

In a new Installation the folder "databases" ist not present. Perheaps the issue can be solved so:

from py4web.core import required_folder
db = DAL(
"sqlite://storage.db", folder=required_folder(os.path.dirname(*file*),
"databases")
)
db.define_table("todo", Field("info"))
db.commit()

—
Reply to this email directly, view it on GitHub
<https://github.com/web2py/py4web-example-apps/issues/1>, or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAHLZT7C2K2C7PFNIKFTTRDZLYPGXAVCNFSM6AAAAABKWIUUXOVHI2DSMVQWIX3LMV43ASLTON2WKOZSGQYDEMZTHA3TIMA>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>