Articles of python

Google App Engine“manual_scaling”无法正常工作

目前,我的Google App Enginedevise的前端通过url提取与常驻后端对话。 新的devise将使用一个模块,而不是后端 。 这是谷歌希望人们走的方向,所以这不应该是困难的,但让这个在生产中运行已经困扰了我好几天。 “ manual_scaling ”只是不适合我。 dev_appserver.py(1.8.3)中的“manual_scaling”工作正常,在生产中不起作用。 我尽可能简化了这个问题。 这里有四个文件应该重现这个问题: 源代码 的app.yaml api_version: 1 application: myapp version: 123456 runtime: python27 threadsafe: true handlers: – url: /send_hello/.* script: send_hello.app – url: /hello/.* script: hello.app hello.yaml api_version: 1 application: myapp module: hello version: 123456 runtime: python27 threadsafe: true #comment out these next two lines and […]

有没有办法备份Python模块?

有没有办法备份Python模块? 我安装了很多模块。 如果我的系统无法正常工作,我将全部失去它们。 有没有办法做到这一点?

一目了然从Openstack存储图像

当我SSH服务器有没有图像在var / lib / glance / images root@Glance:/var/lib/glance# ls glance.sqlite image-cache images 所有文件夹都是空的, glance.sqlite是27kb 那么所有的图像在哪里? 我的目标是find他们并复制到另一个OpenStack。

间歇性的“OSError:参数列表太长”用简短的命令(〜125个字符)

在Linux下运行在apache2 + mod_wsgi上的代码有时产生如下输出。 notes.py cmd_list = [ 'abc_generate_pdf', '–cdb-url-prefix', model.config('cdb_url_prefix'), '–request-cid', request_cid, ] log.info("About to run: {!r}".format(cmd_list)) subprocess.Popen(cmd_list) … 2014-07-16 11:03:44,779 INFO pid:17925,140353357215488 abc.webapp.check.notes:198:approval_revoke About to run: ['abc_generate_pdf', '–cdb-url-prefix', 'xxxxdev', '–request-cid', u'xxxxx_xxx_2014-07-15_16.12.50.108807_685932a62c7c6226987acdeda367dbc3'] 2014-07-16 11:03:45,250 ERROR pid:17925,140353357215488 abc.webapp.check.notes:208:approval_revoke Unknown error; approval not updated. Traceback (most recent call last): File "/home/abc/abc/webapp/check/notes.py", line 199, in approval_revoke subprocess.Popen(cmd_list) File […]

为什么我的Python脚本不能写入文件?

我可以: python script.py > logfile 2>&1 一旦我杀死它使用CTRL C我可以看到日志文件的变化。 但是,当我这样做的时候: python script.py > logfile 2>&1 & 我看不到日志文件的任何更改。 我怎么能背景我的脚本,并仍然写入日志文件?

Centos 6 – sudo在为Python 3.4安装mysqlclient时无法识别pip3.4

我是Centos 6和Linux新手。 我需要安装Python 3.4但是Python 2.6.6默认使用Centos 6 。 我已经将Python 3.4安装到/usr/local/lib/Python3.4 。 不过,我在安装mysqlclient时遇到了问题。 我试过pip3.4 install mysqlclient 。 这是错误信息。 错误 _mysql.c:29:23: error: my_config.h: No such file or directory _mysql.c:30:19: error: mysql.h: No such file or directory _mysql.c:31:26: error: mysqld_error.h: No such file or directory _mysql.c:51:20: error: errmsg.h: No such file or directory _mysql.c:74: error: expected specifier-qualifier-list before 'MYSQL […]

我如何在Linux中使用Python的警告对话框?

我的问题类似于这个问题 ,但我使用Xubuntu,所以win32 API显然是不可用的。 有一些替代我可以使用吗? 我只需要一个简单的窗口popup一条消息,从一个Python脚本。

用python交叉编译gdb for arm失败

我想在像Android机器这样的设备上debuggingARM应用程序,我宁愿使用gdb(ARM版本)而不使用gdb与gdbserver进行debugging,因为在Python中有一个仪表板 ,用于GDB的可视化界面。 它必须在设备上与gdb(ARM版本)合作,所以我需要用python交叉编译gdb的ARM版本,下面的命令显示如下: ./configure –host=arm-linux-gnueabi –target=arm-linux-gnueabi –with-python=/usr/bin 但最后出现了一个错误信息: configure:8096: checking whether to use python configure:8098: result: /usr/bin/ configure:8316: checking for python2.7 configure:8334: arm-linux-gnueabi-gcc -o conftest -g -O2 -I/usr/include/python2.7 -I/usr/include/python2.7 conftest.c -ldl -ltermcap -lm -lpthread -ldl -lutil -lm -lpython2.7 -Xlinker -export-dynamic -Wl,-O1 -Wl,-Bsymbolic-functions >&5 In file included from /usr/include/python2.7/Python.h:8:0, from conftest.c:50: /usr/include/python2.7/pyconfig.h:15:52: fatal error: arm-linux-gnueabi/python2.7/pyconfig.h: No […]

Cython中的Hello World程序在安装python-dev和链接库之后失败

我创build了一个简单的hello世界程序,并尝试使用gcc执行生成的C程序,但无论我做什么,我都会得到一个未定义引用的大量列表。 有很多类似的问题,但他们都说要安装python-dev(或它的一些变种)或添加链接和加载库的标志,但我已经尝试了这两个选项。 hello.py def main(): print "Hello, World!" if __name__ == "__main__": main() 我运行: cython –embed hello.py 然后我尝试运行一些gcc的变体forms: gcc -I /usr/include/python2.7/ -L /usr/lib/python2.7 -lpython2.7 hello.c -o hello 我得到“Python.h”文件未find或以下错误消息: /tmp/ccxOQlAW.o: In function `__Pyx_PyObject_GetAttrStr': hello.c:(.text+0x95): undefined reference to `PyObject_GetAttr' /tmp/ccxOQlAW.o: In function `__pyx_pf_5hello_main': hello.c:(.text+0x149): undefined reference to `_Py_NoneStruct' hello.c:(.text+0x150): undefined reference to `_Py_NoneStruct' hello.c:(.text+0x15b): undefined reference to […]

在Linux和Python的md5

我使用md5algorithm在Python和Linux中散列相同的string,但我得到不同的值可以指出什么是错的 在linux中: echo "logdir" | md5sum – | awk '{print $1}' echo "logdir" | md5sum – | awk '{print $1}' gives: aba76197efa97e6bd4e542846471b391 在python中: md5.new("logdir".encode('utf-8')).hexdigest() gives: ee6da4c228cfaebfda7f14e4371a097d