Sqlite3 Connection Returned Null

I’m trying to connect to the db3 file of the game with the sqlite3 library.

Here is my connection function. It’s similar to xControl Plugin.

def get_database_connection():
	bot_path = os.getcwd()
	data = {}
	with open(bot_path+"/vSRO.json","r") as f:
		data = json.load(f)
	server = get_character_data()['server']
	for k in data:
		servers = data[k]['servers']
		if server in servers:
			for path in os.scandir(bot_path+"/Data"):
				if path.is_file() and path.name.endswith(".db3"):
					conn = sqlite3.connect(bot_path+"/Data/"+path.name)
					c = conn.cursor()
					c.execute('SELECT * FROM data WHERE k="path" AND v=?',(data[k]['path'],))
					if c.fetchone():
						return conn
					else:
						conn.close()

I tested it on 4 different computers. It works on two of them and doesn’t work on the other two.
Function returned None. I checked the name and path of db3 file, all correct.

@JellyBitz @Ryan

Edit: “xControl USE” also does not work on the same computers

Check for a windows update for those 2 computers that don’t work.

Thank you for answer. I guess its about intalled windows language.
if windows was installed in Turkish, “Desktop” folder name changes to “Masaüstü” so if client files are extracted to Desktop causing this situation. I’m gonna check it again.

1 Like