Python error handling when working with SQLite database using Peewee ORM
GitHub URL: betsy-electronics/main.py at main · graphicsilvr/betsy-electronics · GitHub
Problem Description
I’m facing issues with three functions in my Betsy Webshop project, and I’m having trouble understanding 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:betsy-webshop-ref2 git:(commited-files) ✗ tree
.
├── README.md
├── **pycache**
│ ├── main.cpython-311-pytest-7.3.1.pyc
│ ├── main.cpython-311.pyc
│ ├── main.cpython-39.pyc
│ ├── models.cpython-311.pyc
│ ├── models.cpython-39.pyc
│ ├── test_data.cpython-311-pytest-7.3.1.pyc
│ └── test_data.cpython-39-pytest-7.2.1.pyc
├── 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: False
Tag Apple updated: False
Tag Headphones updated: False
Tag Laptops updated: False
Test database created and populated successfully.
betsy.db
Pylint Output
I ran Pylint on my code, and here are the issues it reported:
File: main.py
- screenshot available 1
File: models.py
- screenshot available 2
Additional Information
Please let me know if you require any additional information or code snippets to assist with debugging.
Repl link:
https://replit.com/@graphicsilvr/betsy-electronics?v=1
Additional Information:
Please let me know if you require any additional information or code snippets to assist with debugging.