跳转至内容
  • 版块
  • 标签
  • 热门
  • 用户
  • 群组
皮肤
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • 默认(Flatly)
  • 不使用皮肤
折叠

Odoo 中文社区

  1. 主页
  2. 版块
  3. Odoo 安装指南
  4. 无法备份帐套

无法备份帐套

已定时 已固定 已锁定 已移动 Odoo 安装指南
24 帖子 9 发布者 26.8k 浏览
  • 从旧到新
  • 从新到旧
  • 最多赞同
登录后回复
此主题已被删除。只有拥有主题管理权限的用户可以查看。
  • P 离线
    P 离线
    petercn
    写于 最后由 编辑
    #1

    Hi,

    新装的OpenERP all in one, 5.0.15, 不过无法完成数据库/帐套备份,请问是否知道原因?
    warning: could not create backup.

    Peter

    1 条回复 最后回复
    0
    • mrshellyM 离线
      mrshellyM 离线
      mrshelly
      写于 最后由 编辑
      #2

      建议你先看看  server 文件夹下面的  openerp-server.log 文件内容. 看看有没有什么错误信息.

      1 条回复 最后回复
      0
      • digitalsatoriD 离线
        digitalsatoriD 离线
        digitalsatori 管理员
        写于 最后由 编辑
        #3

        你可以在“开始”->“运行“中输入[quote]cmd[/quote],然后在终端窗口中输入

        pg_dump
        

        ,如果显示无法识别的命令,那你就要在windows环境变量path中设置到PostgreSQL下的bin目录的路径。

        如何设置windows环境变量,问google吧

        【上海先安科技】(tony AT openerp.cn)

        1 条回复 最后回复
        0
        • mrshellyM 离线
          mrshellyM 离线
          mrshelly
          写于 最后由 编辑
          #4

          下午同 L21 两人一起就 OpenERP 5.0.15 帐套无法实现备份  做了些代码跟踪.

          最后发现 5.0.15 对于 备份的 pg_dump 的调用方式同 5.0.9 发生了很大的改变.

          5.0.15 使用了 subprocess.Popen 来进行命令调用操作. 这个在 windows 下面似乎有些问题. 最后换回 5.0.9 的 os.popen2 完成 备份问题的修正..

          1 条回复 最后回复
          0
          • L 离线
            L 离线
            linyaohui
            写于 最后由 编辑
            #5

            感谢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呢?

            1 条回复 最后回复
            0
            • wjfonhandW 离线
              wjfonhandW 离线
              wjfonhand
              写于 最后由 编辑
              #6

              毫不留情地呼吁全体社区成员赠香吻给shelly姐姐

              GoodERP -- Odoo China fork

              1 条回复 最后回复
              0
              • S 离线
                S 离线
                stbrine
                写于 最后由 编辑
                #7

                飞吻一个给mrshelly

                1 条回复 最后回复
                0
                • H 离线
                  H 离线
                  hifly
                  写于 最后由 编辑
                  #8

                  赞 shelly 太厉害了

                  1 条回复 最后回复
                  0
                  • digitalsatoriD 离线
                    digitalsatoriD 离线
                    digitalsatori 管理员
                    写于 最后由 编辑
                    #9

                    且慢, 这不只是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&nbsp;  2010-11-04 15:12:38.000000000 +0300<br />+++ misc.py&nbsp;  2010-12-04 11:30:04.000000000 +0300<br />@@ -140,7 +140,7 @@<br />&nbsp; &nbsp;  if not prog:<br />&nbsp; &nbsp; &nbsp; &nbsp;  raise Exception(&#039;Couldn\&#039;t find %s&#039; % name)<br /> <br />-&nbsp; &nbsp; pop = subprocess.Popen(args, executable=prog, shell=True, bufsize= -1,<br />+&nbsp; &nbsp; pop = subprocess.Popen((prog,) + args, bufsize= -1,<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; stdin=subprocess.PIPE, stdout=subprocess.PIPE, close_fds=True)<br />&nbsp; &nbsp;  return (pop.stdin, pop.stdout)<br /> <br />@@ -149,7 +149,7 @@<br />&nbsp; &nbsp;  if not prog:<br />&nbsp; &nbsp; &nbsp; &nbsp;  raise Exception(&#039;Couldn\&#039;t find %s&#039; % name)<br /> <br />-&nbsp; &nbsp; pop = subprocess.Popen(args, executable=prog, shell=True, bufsize= -1,<br />+&nbsp; &nbsp; pop = subprocess.Popen((prog,) + args, bufsize= -1,<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; stdin=subprocess.PIPE, stdout=subprocess.PIPE, close_fds=True)<br />&nbsp; &nbsp;  return (pop.stdin, pop.stdout)<br /> #----------------------------------------------------------
                    



                    很不好意思的要给Shelly姐满是唇印的脸颊留个巴掌印了:

                    Shelly的解法:1.没有找到错误的实质 2. os.popen2是一个Python2.6开始就淘汰(deprecated)的函数,这也是为什么OE会从os.popen2转到subprocess的原因

                    不过还是要感谢Shelly姐一贯的热心助人,无私奉献的精神,鼓掌!

                    【EDIT:】刚才在上面直接拷贝了bug report中的patch文件,回过头一看也是错误的,上面贴出的是修改好的。

                    【上海先安科技】(tony AT openerp.cn)

                    1 条回复 最后回复
                    0
                    • JoshuaJ 离线
                      JoshuaJ 离线
                      Joshua 管理员
                      写于 最后由 编辑
                      #10

                      谢谢LS几位精彩的解答啊。
                      但是我有个疑问,好像这个错误在log里面没有显示出来,要跟踪这个错误就只能直接看代码啦?

                      【上海先安科技】(joshua AT openerp.cn),欢迎关注公众号:openerp_cn

                      1 条回复 最后回复
                      0
                      • digitalsatoriD 离线
                        digitalsatoriD 离线
                        digitalsatori 管理员
                        写于 最后由 编辑
                        #11

                        [quote author=Joshua link=topic=2244.msg7246#msg7246 date=1292549568]
                        但是我有个疑问,好像这个错误在log里面没有显示出来,要跟踪这个错误就只能直接看代码啦?
                        [/quote]
                        好象只在trunk里做了修改: [检测到链接无效,已移除]

                        【上海先安科技】(tony AT openerp.cn)

                        1 条回复 最后回复
                        0
                        • L 离线
                          L 离线
                          linyaohui
                          写于 最后由 编辑
                          #12

                          精彩

                          1 条回复 最后回复
                          0
                          • mrshellyM 离线
                            mrshellyM 离线
                            mrshelly
                            写于 最后由 编辑
                            #13

                            顶起来.
                            今天用 5.0.15 . 按 digitalsatori 的解决方案, 把 misc.py 文件中 的代码 更改为

                            <br />...<br /><br />def exec_pg_command_pipe(name, *args):<br />&nbsp; &nbsp; prog = find_pg_tool(name)<br />&nbsp; &nbsp; if not prog:<br />&nbsp; &nbsp; &nbsp; &nbsp; raise Exception(&#039;Couldn\&#039;t find %s&#039; % name)<br /><br />&nbsp; &nbsp; #pop = subprocess.Popen(args, executable=prog, shell=True, bufsize= -1,<br />&nbsp; &nbsp; #&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  stdin=subprocess.PIPE, stdout=subprocess.PIPE, close_fds=True)<br />&nbsp; &nbsp; pop = subprocess.Popen((prog,) + args, bufsize= -1,<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; stdin=subprocess.PIPE, stdout=subprocess.PIPE, close_fds=True)<br />&nbsp; &nbsp; return (pop.stdin, pop.stdout)<br /><br />def exec_command_pipe(name, *args):<br />&nbsp; &nbsp; prog = find_in_path(name)<br />&nbsp; &nbsp; if not prog:<br />&nbsp; &nbsp; &nbsp; &nbsp; raise Exception(&#039;Couldn\&#039;t find %s&#039; % name)<br /><br />&nbsp; &nbsp; #pop = subprocess.Popen(args, executable=prog, shell=True, bufsize= -1,<br />&nbsp; &nbsp; #&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  stdin=subprocess.PIPE, stdout=subprocess.PIPE, close_fds=True)<br />&nbsp; &nbsp; pop = subprocess.Popen((prog,) + args, bufsize= -1,<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; stdin=subprocess.PIPE, stdout=subprocess.PIPE, close_fds=True)<br /><br />&nbsp; &nbsp; return (pop.stdin, pop.stdout)<br />...<br />
                            



                            替换后, 还是备份出错.  digitalsatori 测试过了吗? 或者再深入看一下? 谢谢.

                            目前暂时还是使用 os.popen2 解决...

                            1 条回复 最后回复
                            0
                            • mrshellyM 离线
                              mrshellyM 离线
                              mrshelly
                              写于 最后由 编辑
                              #14

                              好吧. 自己解决了.

                              是因为 windows 不支持 close_fds 参数. 所以, 只需要按校长的 改. 并把 close_fds 参数去掉即可.

                              既然 校长 B4我了一下... 我也B4校长一下... 哪能不测试就发出来哩... 最起码 os.popen2 的还能用嘛.. 嘿嘿嘿

                              <br />...<br /><br />def exec_pg_command_pipe(name, *args):<br />&nbsp; &nbsp; prog = find_pg_tool(name)<br />&nbsp; &nbsp; if not prog:<br />&nbsp; &nbsp; &nbsp; &nbsp; raise Exception(&#039;Couldn\&#039;t find %s&#039; % name)<br /><br />&nbsp; &nbsp; #pop = subprocess.Popen(args, executable=prog, shell=True, bufsize= -1,<br />&nbsp; &nbsp; #&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  stdin=subprocess.PIPE, stdout=subprocess.PIPE, close_fds=True)<br />&nbsp; &nbsp; pop = subprocess.Popen((prog,) + args, bufsize= -1, stdin=subprocess.PIPE, stdout=subprocess.PIPE)<br />&nbsp; &nbsp; return (pop.stdin, pop.stdout)<br /><br />def exec_command_pipe(name, *args):<br />&nbsp; &nbsp; prog = find_in_path(name)<br />&nbsp; &nbsp; if not prog:<br />&nbsp; &nbsp; &nbsp; &nbsp; raise Exception(&#039;Couldn\&#039;t find %s&#039; % name)<br /><br />&nbsp; &nbsp; #pop = subprocess.Popen(args, executable=prog, shell=True, bufsize= -1,<br />&nbsp; &nbsp; #&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  stdin=subprocess.PIPE, stdout=subprocess.PIPE, close_fds=True)<br />&nbsp; &nbsp; pop = subprocess.Popen((prog,) + args, bufsize= -1, stdin=subprocess.PIPE, stdout=subprocess.PIPE)<br /><br />&nbsp; &nbsp; return (pop.stdin, pop.stdout)<br />...<br />
                              



                              5.0.15 server 测试通过...

                              1 条回复 最后回复
                              0
                              • digitalsatoriD 离线
                                digitalsatoriD 离线
                                digitalsatori 管理员
                                写于 最后由 编辑
                                #15

                                B4的有理,偶也B4一下校长。 😄 多谢Shelly同学

                                【上海先安科技】(tony AT openerp.cn)

                                1 条回复 最后回复
                                0
                                • X 离线
                                  X 离线
                                  xtjie
                                  写于 最后由 编辑
                                  #16

                                  请问在windows下可以修改吗?如果能修改,改哪儿.

                                  1 条回复 最后回复
                                  0
                                  • mrshellyM 离线
                                    mrshellyM 离线
                                    mrshelly
                                    写于 最后由 编辑
                                    #17

                                    [quote author=xtjie link=topic=2244.msg7385#msg7385 date=1295247745]
                                    请问在windows下可以修改吗?如果能修改,改哪儿.
                                    [/quote]


                                    我说的就是 windows 下的.

                                    只需要修改 windows openerp server 文件夹下的  library.zip 文件里对应的文件 就行了...

                                    1 条回复 最后回复
                                    0
                                    • X 离线
                                      X 离线
                                      xtjie
                                      写于 最后由 编辑
                                      #18

                                      library.zip 里的文件都是 .pyo编译过的文件,我在源文件里修改完,用python -O 编译出现缺少模块的编译错误,总不能再生成一个windows的 server 安装包. 或者把misc.py 修改完直接放在library.zip里,是否可行.

                                      1 条回复 最后回复
                                      0
                                      • mrshellyM 离线
                                        mrshellyM 离线
                                        mrshelly
                                        写于 最后由 编辑
                                        #19

                                        [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 文件的.

                                        1 条回复 最后回复
                                        0

                                        • 登录

                                        • 没有帐号? 注册

                                        • 登录或注册以进行搜索。
                                        • 第一个帖子
                                          最后一个帖子
                                        0
                                        • 版块
                                        • 标签
                                        • 热门
                                        • 用户
                                        • 群组