
Odoo中文社区可以通过以下两个域名访问:shine-it.net , odoo.net.cn
由于系统升迁的原因,本论坛部分较早期的内容存在格式和链接损坏失效的问题,并非本论坛系统本身的缺陷,望谅解
本社区没有维护任何QQ群讨论组,任何与本社区同名的QQ群讨论组的言论与本社区无关!
开发人员可以登录gitter讨论组: http://gitter.im/odoo-china/Talk, 需要github账号
如果您登录系统碰到问题,请在微信公众号留言:
无法备份帐套
-
Hi,
新装的OpenERP all in one, 5.0.15, 不过无法完成数据库/帐套备份,请问是否知道原因?
warning: could not create backup.
Peter -
建议你先看看 server 文件夹下面的 openerp-server.log 文件内容. 看看有没有什么错误信息.
-
你可以在“开始”->“运行“中输入[quote]cmd[/quote],然后在终端窗口中输入
pg_dump
,如果显示无法识别的命令,那你就要在windows环境变量path中设置到PostgreSQL下的bin目录的路径。
如何设置windows环境变量,问google吧 -
下午同 L21 两人一起就 OpenERP 5.0.15 帐套无法实现备份 做了些代码跟踪.
最后发现 5.0.15 对于 备份的 pg_dump 的调用方式同 5.0.9 发生了很大的改变.
5.0.15 使用了 subprocess.Popen 来进行命令调用操作. 这个在 windows 下面似乎有些问题. 最后换回 5.0.9 的 os.popen2 完成 备份问题的修正.. -
感谢shelly指导,解决过程是用
def exec_pg_command_pipe(name, *args):
prog = find_pg_tool(name)
if not prog:
raise Exception('Couldn't find %s' % name)
if os.name == "nt":
cmd = '"' + prog + '" ' + ' '.join(args)
else:
cmd = prog + ' ' + ' '.join(args)
return os.popen2(cmd, 'b')
代替了tools下面misc文件的
中的
def exec_pg_command_pipe(name, *args):
prog = find_pg_tool(name)
if not prog:
raise Exception('Couldn't find %s' % name)
pop = subprocess.Popen(args, executable=prog, shell=True, bufsize= -1,
stdin=subprocess.PIPE, stdout=subprocess.PIPE, close_fds=True)
return (pop.stdin, pop.stdout)
shelly完美解决了问题,请shelly兄能分享下解决思路!俺还是一知半解,例如怎样知道问题是在tools下的misc。py呢? -
毫不留情地呼吁全体社区成员赠香吻给shelly姐姐
-
飞吻一个给mrshelly
-
赞 shelly 太厉害了
-
且慢, 这不只是windows下的问题,Linux下也存在问题,查了一下subprocess的文档,发现Open ERP5.0.15在使用subprocess.Popen时参数设定是错误的。正待向Lauchpad上提交Bug Report, 发现该bug在月初时就有人发现并且在版本库中已解决(https://bugs.launchpad.net/openobject-server/+bug/685115),这就是开源的优势之一,修改的方法很简单:
--- /home/mtm/openerp-server-5.0.15/bin/tools/misc.py 2010-11-04 15:12:38.000000000 +0300<br />+++ misc.py 2010-12-04 11:30:04.000000000 +0300<br />@@ -140,7 +140,7 @@<br /> if not prog:<br /> raise Exception('Couldn\'t find %s' % name)<br /> <br />- pop = subprocess.Popen(args, executable=prog, shell=True, bufsize= -1,<br />+ pop = subprocess.Popen((prog,) + args, bufsize= -1,<br /> stdin=subprocess.PIPE, stdout=subprocess.PIPE, close_fds=True)<br /> return (pop.stdin, pop.stdout)<br /> <br />@@ -149,7 +149,7 @@<br /> if not prog:<br /> raise Exception('Couldn\'t find %s' % name)<br /> <br />- pop = subprocess.Popen(args, executable=prog, shell=True, bufsize= -1,<br />+ pop = subprocess.Popen((prog,) + args, bufsize= -1,<br /> stdin=subprocess.PIPE, stdout=subprocess.PIPE, close_fds=True)<br /> return (pop.stdin, pop.stdout)<br /> #----------------------------------------------------------
很不好意思的要给Shelly姐满是唇印的脸颊留个巴掌印了:
Shelly的解法:1.没有找到错误的实质 2. os.popen2是一个Python2.6开始就淘汰(deprecated)的函数,这也是为什么OE会从os.popen2转到subprocess的原因
不过还是要感谢Shelly姐一贯的热心助人,无私奉献的精神,鼓掌!
【EDIT:】刚才在上面直接拷贝了bug report中的patch文件,回过头一看也是错误的,上面贴出的是修改好的。 -
谢谢LS几位精彩的解答啊。
但是我有个疑问,好像这个错误在log里面没有显示出来,要跟踪这个错误就只能直接看代码啦? -
[quote author=Joshua link=topic=2244.msg7246#msg7246 date=1292549568]
但是我有个疑问,好像这个错误在log里面没有显示出来,要跟踪这个错误就只能直接看代码啦?
[/quote]
好象只在trunk里做了修改: [检测到链接无效,已移除] -
精彩
-
顶起来.
今天用 5.0.15 . 按 digitalsatori 的解决方案, 把 misc.py 文件中 的代码 更改为<br />...<br /><br />def exec_pg_command_pipe(name, *args):<br /> prog = find_pg_tool(name)<br /> if not prog:<br /> raise Exception('Couldn\'t find %s' % name)<br /><br /> #pop = subprocess.Popen(args, executable=prog, shell=True, bufsize= -1,<br /> # stdin=subprocess.PIPE, stdout=subprocess.PIPE, close_fds=True)<br /> pop = subprocess.Popen((prog,) + args, bufsize= -1,<br /> stdin=subprocess.PIPE, stdout=subprocess.PIPE, close_fds=True)<br /> return (pop.stdin, pop.stdout)<br /><br />def exec_command_pipe(name, *args):<br /> prog = find_in_path(name)<br /> if not prog:<br /> raise Exception('Couldn\'t find %s' % name)<br /><br /> #pop = subprocess.Popen(args, executable=prog, shell=True, bufsize= -1,<br /> # stdin=subprocess.PIPE, stdout=subprocess.PIPE, close_fds=True)<br /> pop = subprocess.Popen((prog,) + args, bufsize= -1,<br /> stdin=subprocess.PIPE, stdout=subprocess.PIPE, close_fds=True)<br /><br /> return (pop.stdin, pop.stdout)<br />...<br />
替换后, 还是备份出错. digitalsatori 测试过了吗? 或者再深入看一下? 谢谢.
目前暂时还是使用 os.popen2 解决... -
好吧. 自己解决了.
是因为 windows 不支持 close_fds 参数. 所以, 只需要按校长的 改. 并把 close_fds 参数去掉即可.
既然 校长 B4我了一下... 我也B4校长一下... 哪能不测试就发出来哩... 最起码 os.popen2 的还能用嘛.. 嘿嘿嘿<br />...<br /><br />def exec_pg_command_pipe(name, *args):<br /> prog = find_pg_tool(name)<br /> if not prog:<br /> raise Exception('Couldn\'t find %s' % name)<br /><br /> #pop = subprocess.Popen(args, executable=prog, shell=True, bufsize= -1,<br /> # stdin=subprocess.PIPE, stdout=subprocess.PIPE, close_fds=True)<br /> pop = subprocess.Popen((prog,) + args, bufsize= -1, stdin=subprocess.PIPE, stdout=subprocess.PIPE)<br /> return (pop.stdin, pop.stdout)<br /><br />def exec_command_pipe(name, *args):<br /> prog = find_in_path(name)<br /> if not prog:<br /> raise Exception('Couldn\'t find %s' % name)<br /><br /> #pop = subprocess.Popen(args, executable=prog, shell=True, bufsize= -1,<br /> # stdin=subprocess.PIPE, stdout=subprocess.PIPE, close_fds=True)<br /> pop = subprocess.Popen((prog,) + args, bufsize= -1, stdin=subprocess.PIPE, stdout=subprocess.PIPE)<br /><br /> return (pop.stdin, pop.stdout)<br />...<br />
5.0.15 server 测试通过... -
B4的有理,偶也B4一下校长。
多谢Shelly同学
-
请问在windows下可以修改吗?如果能修改,改哪儿.
-
[quote author=xtjie link=topic=2244.msg7385#msg7385 date=1295247745]
请问在windows下可以修改吗?如果能修改,改哪儿.
[/quote]
我说的就是 windows 下的.
只需要修改 windows openerp server 文件夹下的 library.zip 文件里对应的文件 就行了... -
library.zip 里的文件都是 .pyo编译过的文件,我在源文件里修改完,用python -O 编译出现缺少模块的编译错误,总不能再生成一个windows的 server 安装包. 或者把misc.py 修改完直接放在library.zip里,是否可行.
-
[quote author=xtjie link=topic=2244.msg7387#msg7387 date=1295311398]
library.zip 里的文件都是 .pyo编译过的文件,我在源文件里修改完,用python -O 编译出现缺少模块的编译错误,总不能再生成一个windows的 server 安装包. 或者把misc.py 修改完直接放在library.zip里,是否可行.
[/quote]
try it .
注意 优先级.
当 .pyc .pyo 文件存在时. python 是不会去理会 .py 文件的.