Python error handling when working with SQLite database using Peewee ORM

Problem Description

I’m facing issues with three functions in my Betsy electronics project, and I’m having trouble solving the errors. Here are the possible causes I have identified:

  • There might be indentation errors.
  • The functions might be missing imports.
  • The functions might not be written correctly, resulting in a syntax error.

File Structure

Here is the file structure of my application:

Tree

├── README.md
├── betsy.db
├── license.txt
├── main.py
├── models.py
└── test_data.py

Functions Not Populating SQLite Database

The following functions are not populating the SQLite database, and I’m unable to determine the cause:

  • ProductTag
  • User
  • UserProduct

Output and Error Messages

When running my program, I receive the following output:
Product 1 created: True
Product 2 created: True
Product 3 created: True
Product 4 created: True

Tag Electronics updated:

True Tag Apple updated:
True Tag Headphones updated: True
Tag Laptops updated: True

Test database created and populated successfully.

betsy.db

Test database created and populated successfully.

betsy.db

linting Output

I ran tool for error handling on my code, and here are some of the issues it reported:

  • File: ‘main.py’
  • File: ‘models.py’

Additional Information

Please let me know if you require any additional information or code snippets to assist with debugging.

I don’t totally understand your problem so I just want to clarify. Are you seeing that you have errors when you run your program? You mention that there might be syntax or indentation errors, but I’m not sure if that means you do know that you have those or you’re just not sure? If you had syntax errors that should be resulting in a compile time error telling you exactly what those are. This is true for all of the errors that you described as far as syntax, indentation, and functions not being written incorrectly, which also falls under a syntax error.

1 Like

Hi, Tranquilli. This problem is already solved my database is populating fine. Now there are other challenges with improving my application that i have to solve. Thanks for your reply.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.