小编ved*_*ran的帖子

获取TypeError:'Module'对象在celery任务装饰器上不可调用

试试django的芹菜我遇到了@task装饰的问题.这是在Windows 7上运行的.

在我的celerytest.tasks模块中,我有以下代码

from celery import task

@task
def add(x,y):
    return x + y
Run Code Online (Sandbox Code Playgroud)

从命令提示符我运行:

python manage.py shell
Run Code Online (Sandbox Code Playgroud)

试图从shell导入我的模块:

from celerytest.tasks import add
Run Code Online (Sandbox Code Playgroud)

我收到以下错误:

>>> from celerytest.tasks import add
Traceback (most recent call last):
File "<console>", line 1, in <module>
File "d:\...\celerytest\tasks.py", line 8, in <module>
   @task
TypeError: 'module' object is not callable
Run Code Online (Sandbox Code Playgroud)

我试着用谷歌搜索了很长时间,但似乎我是世界上唯一一个有这个问题的人.

django celery

7
推荐指数
1
解决办法
3760
查看次数

插入某些Unicode字符时参数化查询失败

尝试通过参数查询插入某些字符时遇到问题.

当我运行以下查询(不涉及参数)时,一切正常.

string insertQuery = "insert into 'testschema'.texttypestestobject(columnshortstring,columnlongstring)values('¬','test')";
DB2Command myCommand = new DB2Command(insertQuery, conn);
myCommand.ExecuteNonQuery();
Run Code Online (Sandbox Code Playgroud)

但是,如果我像下面这样运行查询,则会失败.

string insertQuery = "insert into 'testschema'.texttypestestobject(columnshortstring,columnlongstring)values(@p0,@p1')";
DB2Command myCommand = new DB2Command(insertQuery, conn);
myCommand.Parameters.Add(new DB2Parameter("@p0", "¬"));
myCommand.Parameters.Add(new DB2Parameter("@p1", "test"));
myCommand.ExecuteNonQuery();
Run Code Online (Sandbox Code Playgroud)

错误是:

Executing Sql 'insert into 'testschema'.texttypestestobject(columnshortstring,columnlongstring)values(@p0,@p1)'
with parameters '{¬},{ test}' exception 'IBM.Data.DB2.DB2Exception (0x80004005):
ERROR [IX000] [IBM][IDS/NT64] Code-set conversion function failed due to illegal
sequence or invalid value.
Run Code Online (Sandbox Code Playgroud)

已安装Informix服务器11.70(64位)和Client SDK 3.50,并且正常运行.使用en_US.utf8或cs_CZ.8859-2创建数据库.

失败的一个字符是'¬'(Unicode 172).

有没有人见过这个错误?可能是什么原因?是否需要在驱动程序上执行一些其他配置?

.net informix driver

6
推荐指数
1
解决办法
638
查看次数

标签 统计

.net ×1

celery ×1

django ×1

driver ×1

informix ×1