我正在尝试建立从python2.7到H2的连接(h2-1.4.193.jar - 最新)
H2(正在运行且可用): java -Dh2.bindAddress=127.0.0.1 -cp "E:\Dir\h2-1.4.193.jar;%H2DRIVERS%;%CLASSPATH%" org.h2.tools.Server -tcpPort 15081 -baseDir E:\Dir\db
对于我正在使用的python jaydebeapi:
import jaydebeapi
conn = jaydebeapi.connect('org.h2.Driver', ['jdbc:h2:tcp://localhost:15081/db/test', 'sa', ''], 'E:\Path\to\h2-1.4.193.jar')
curs = conn.cursor()
curs.execute('create table PERSON ("PERSON_ID" INTEGER not null, "NAME" VARCHAR not null, primary key ("PERSON_ID"))')
curs.execute("insert into PERSON values (1, 'John')")
curs.execute("select * from PERSON")
data = curs.fetchall()
print(data)
Run Code Online (Sandbox Code Playgroud)
因此,每当我收到错误时:Process finished with exit code -1073741819 (0xC0000005)
您对此案件有任何想法吗?或者也许还有其他东西我可以使用而不是jaydebeapi?
我必须在单独的线程中启动 discord.py,因为我无法阻止我的主线程。
这是一个游戏服务器C/Python 3.7 (ubuntu 18)
代码:
int pysDiscord_Init;
...
PyObject *psv_discord;
psv_discord = Python_LoadModule("sv_discord");
if (psv_discord != NULL) {
pysDiscord_Init = Python_RegisterFunction(psv_discord, "sv_discord", "init");
Python_Execute(pysDiscord_Init, "");
}
Run Code Online (Sandbox Code Playgroud)
sv_discord.py
import discord
import asyncio
import threading
from concurrent.futures import ThreadPoolExecutor
import multiprocessing
TOKEN = '12345'
client = discord.Client()
def init():
print("Initializing Discord...")
print("current_thread: %s" % threading.current_thread())
t = threading.Thread(target=client.run, args=(TOKEN,))
t.start()
or
def init():
print("Initializing Discord...")
print("current_thread: %s" % threading.current_thread())
loop = asyncio.new_event_loop()
asyncio.set_event_loop(loop)
asyncio.get_child_watcher().attach_loop(loop)
pool = ThreadPoolExecutor(max_workers=multiprocessing.cpu_count())
task = …Run Code Online (Sandbox Code Playgroud) 这是我的结构:
Person.html
...
<script src="../../js/site.js"></script>
...
<a id="findPersonById" href="javascript:void(0);" class="btn btn-primary">
Find person by id</a>
...
<div id="person-result">results div</div>
Run Code Online (Sandbox Code Playgroud)
Site.js
$(document).ready(function () {
privateFunction();
});
...
$('#findPersonById').click(function () {
$("#person-result").load('/person/find #inside-container');
});
...
Run Code Online (Sandbox Code Playgroud)
/人/找
<script src="../../js/site.js"></script>
...
<div class="container">
<div id="inside-container">
<br/>
<form id="personFindByIdForm">
<div class="form-group">
<div class="input-group">
<span class="input-group-addon">PERSON'S ID</span>
<input type="text" class="form-control" name="id"/>
<span class="input-group-btn">
<button class="btn btn-default" type="submit">Find</button>
</span>
</div>
</div>
</form>
<div id="find-result">res-div</div>
</div>
Run Code Online (Sandbox Code Playgroud)
所以,首先我发现的#findPersonById和装载/person/find #inside-container的#person-result.有用.我的下一步是要找到两个ID #personFindByIdForm和#find-result.我不能这样做,因为如果我是对的,文件已经加载了.我怎么能这样做? …
asynchronous ×1
c ×1
discord.py ×1
h2 ×1
javascript ×1
jaydebeapi ×1
jquery ×1
python-2.7 ×1
python-3.x ×1