I am trying to invoke the SQLITE3 API to backup a database. I found a sample script which does this and I was testing it.
Some searches pointed me to a 'fix' with the find_library part of the code, that I should replace it with the full path to the DLL. I did that. That is when I started to get the subject error. Searching on the error pointed me to this forum, but not to a resolution.
I'm in Win10; Python 3.6.3/64 and I am trying this with SQLite3 3.22.0.0/64 DLL I just downloaded.
Python 3.6.3 (v3.6.3:2c5fed8, Oct 3 2017, 18:11:49) [MSC v.1900 64 bit (AMD64)] on win32
The code dies in the CDDL call.
Traceback (most recent call last):
File "PCT_DB_backup_sample.py", line 18, in <module>
sqlite = ctypes.CDLL(r'c:\Users\edlip\Documents\code\python\SQLite3\sqlite3.dll')
File "c:\Users\edlip\AppData\Local\Programs\Python\Python36\Lib\ctypes\__init__.py", line 348, in __init__
self._handle = _dlopen(self._name, mode)
OSError: [WinError 193] %1 is not a valid Win32 application
I was doing some other Python stuff, hit a SQLite3 can't load error for something which should work (BUKU). I reverted the DLL from a backup and I'm past the error. There must be some issue with the DLL. I'll stay at an older, not bleeding edge, version of SQLite3.
Some searches pointed me to a 'fix' with the find_library part of the code, that I should replace it with the full path to the DLL. I did that. That is when I started to get the subject error. Searching on the error pointed me to this forum, but not to a resolution.
I'm in Win10; Python 3.6.3/64 and I am trying this with SQLite3 3.22.0.0/64 DLL I just downloaded.
Python 3.6.3 (v3.6.3:2c5fed8, Oct 3 2017, 18:11:49) [MSC v.1900 64 bit (AMD64)] on win32
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
#! /usr/bin/env python # Of course, the author does not guarantee safety. # I did my best by using SQLite's online backup API. from __future__ import print_function import sys, ctypes from ctypes.util import find_library SQLITE_OK = 0 SQLITE_ERROR = 1 SQLITE_BUSY = 5 SQLITE_LOCKED = 6 SQLITE_OPEN_READONLY = 1 SQLITE_OPEN_READWRITE = 2 SQLITE_OPEN_CREATE = 4 # sqlite = ctypes.CDLL(find_library('sqlite3')) sqlite = ctypes.CDLL(r 'c:\Users\edlip\Documents\code\python\SQLite3\sqlite3.dll' ) sqlite.sqlite3_backup_init.restype = ctypes.c_void_p |
Traceback (most recent call last):
File "PCT_DB_backup_sample.py", line 18, in <module>
sqlite = ctypes.CDLL(r'c:\Users\edlip\Documents\code\python\SQLite3\sqlite3.dll')
File "c:\Users\edlip\AppData\Local\Programs\Python\Python36\Lib\ctypes\__init__.py", line 348, in __init__
self._handle = _dlopen(self._name, mode)
OSError: [WinError 193] %1 is not a valid Win32 application
I was doing some other Python stuff, hit a SQLite3 can't load error for something which should work (BUKU). I reverted the DLL from a backup and I'm past the error. There must be some issue with the DLL. I'll stay at an older, not bleeding edge, version of SQLite3.