kyleskom / NBA-Machine-Learning-Sports-Betting

NBA sports betting using machine learning
1.23k stars 443 forks source link

File is not a database after python -m Get_Odds_Data #439

Open steamerg opened 5 months ago

steamerg commented 5 months ago

Hi, so I try to train the model, but when I am getting the odds data, I am getting the error below, its ok until Getting odds data: 2024-04-28, after that I got the error. Can you help me with that please?

Traceback (most recent call last): File "AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\pandas\io\sql.py", line 2264, in execute cur.execute(sql, *args) sqlite3.DatabaseError: file is not a database

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "", line 198, in _run_module_as_main File "", line 88, in _run_code File "NBA-Machine-Learning-Sports-Betting-master\src\Process-Data\Get_Odds_Data.py", line 74, in df.to_sql(key, con, if_exists="replace") File "AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\pandas\util_decorators.py", line 333, in wrapper return func(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^ File "AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\pandas\core\generic.py", line 3008, in to_sql return sql.to_sql( ^^^^^^^^^^^ File "AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\pandas\io\sql.py", line 788, in to_sql return pandas_sql.to_sql( ^^^^^^^^^^^^^^^^^^ File "AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\pandas\io\sql.py", line 2440, in to_sql table.create() File "AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\pandas\io\sql.py", line 925, in create if self.exists(): ^^^^^^^^^^^^^ File "AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\pandas\io\sql.py", line 911, in exists return self.pd_sql.has_table(self.name, self.schema) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\pandas\io\sql.py", line 2455, in has_table return len(self.execute(query, [name]).fetchall()) > 0 ^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\pandas\io\sql.py", line 2276, in execute raise ex from exc pandas.errors.DatabaseError: Execution failed on sql ' SELECT name FROM sqlite_master WHERE type IN ('table', 'view') AND name=?; ': file is not a database

I also had to change the src\Process-Data\Get_Odds_Data's con = sqlite3.connect line and give it the absolute path because it was unable to find it. Could this be related to it?