Loading ...
Sorry, an error occurred while loading the content.
 

Exit when loaded invalid python 2.7

Expand Messages
  • Taro MURAOKA
    Hi list and Bram. I wrote a patch to fix a problem related if_python. Please check attached. Problem: When python 2.7 can t find site module, vim is exit.
    Message 1 of 4 , Jul 20, 2014
      Hi list and Bram.


      I wrote a patch to fix a problem related if_python.
      Please check attached.


      Problem:
      When python 2.7 can't find "site" module, vim is exit.
      For example, on Windows which not installed official python 2.7,
      but installed Mecurial or so (py2exe'ed binary),
      Vim will try to load python27.dll of Mercurial,
      but it failed to load "site" module, and exit.

      The cause:
      Python try to load "site" module, and if it is failed, call exit().
      See at line 718 in http://svn.python.org/view/python/branches/release27-maint/Python/pythonrun.c?revision=85905&view=markup

      Solution:
      Suppress to load "site" module by setting Py_NoSiteFlag before Py_Initialize(),
      then load it explicitly.

      --
      --
      You received this message from the "vim_dev" maillist.
      Do not top-post! Type your reply below the text you are replying to.
      For more information, visit http://www.vim.org/maillist.php

      ---
      You received this message because you are subscribed to the Google Groups "vim_dev" group.
      To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscribe@....
      For more options, visit https://groups.google.com/d/optout.
    • Bram Moolenaar
      ... Is loading the site module done by all versions of Python, or was it added recently? I suppose that without the site module Python cannot do its work?
      Message 2 of 4 , Jul 20, 2014
        Taro Muraoka wrote:

        > Hi list and Bram.
        >
        > I wrote a patch to fix a problem related if_python.
        > Please check attached.
        >
        > Problem:
        > When python 2.7 can't find "site" module, vim is exit.
        > For example, on Windows which not installed official python 2.7,
        > but installed Mecurial or so (py2exe'ed binary),
        > Vim will try to load python27.dll of Mercurial,
        > but it failed to load "site" module, and exit.
        >
        > The cause:
        > Python try to load "site" module, and if it is failed, call exit().
        > See at line 718 in http://svn.python.org/view/python/branches/release27-maint/Python/pythonrun.c?revision=85905&view=markup
        >
        > Solution:
        > Suppress to load "site" module by setting Py_NoSiteFlag before Py_Initialize(),
        > then load it explicitly.

        Is loading the "site" module done by all versions of Python, or was it
        added recently?

        I suppose that without the "site" module Python cannot do its work?


        --
        SOLDIER: What? Ridden on a horse?
        ARTHUR: Yes!
        SOLDIER: You're using coconuts!
        "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD

        /// Bram Moolenaar -- Bram@... -- http://www.Moolenaar.net \\\
        /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
        \\\ an exciting new programming language -- http://www.Zimbu.org ///
        \\\ help me help AIDS victims -- http://ICCF-Holland.org ///

        --
        --
        You received this message from the "vim_dev" maillist.
        Do not top-post! Type your reply below the text you are replying to.
        For more information, visit http://www.vim.org/maillist.php

        ---
        You received this message because you are subscribed to the Google Groups "vim_dev" group.
        To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscribe@....
        For more options, visit https://groups.google.com/d/optout.
      • MURAOKA Taro
        Hi. ... I don t think all version. But as I can check, python 2.0-7 are loading the site module. 2.0 -
        Message 3 of 4 , Jul 20, 2014
          Hi.

          > Is loading the "site" module done by all versions of Python, or was it
          > added recently?

          I don't think all version.
          But as I can check, python 2.0-7 are loading the "site" module.

          2.0 - http://svn.python.org/view/python/branches/release20-maint/Python/pythonrun.c?view=markup
          2.2 - http://svn.python.org/view/python/branches/release22-maint/Python/pythonrun.c?view=markup
          2.6 - http://svn.python.org/view/python/branches/release26-maint/Python/pythonrun.c?view=markup

          But it seems that only 2.7 call "exit()" when it failed.

          > I suppose that without the "site" module Python cannot do its work?

          Pure Python may be able to work without the "site" module.
          Python CLI has an option "-S" to disable implicit "site" loading.
          But most of existing Vim plugins which use Python interface,
          would expect "site" is loaded implicitly.

          2014-07-21 5:05 GMT+09:00 Bram Moolenaar <Bram@...>:
          >
          > Taro Muraoka wrote:
          >
          >> Hi list and Bram.
          >>
          >> I wrote a patch to fix a problem related if_python.
          >> Please check attached.
          >>
          >> Problem:
          >> When python 2.7 can't find "site" module, vim is exit.
          >> For example, on Windows which not installed official python 2.7,
          >> but installed Mecurial or so (py2exe'ed binary),
          >> Vim will try to load python27.dll of Mercurial,
          >> but it failed to load "site" module, and exit.
          >>
          >> The cause:
          >> Python try to load "site" module, and if it is failed, call exit().
          >> See at line 718 in http://svn.python.org/view/python/branches/release27-maint/Python/pythonrun.c?revision=85905&view=markup
          >>
          >> Solution:
          >> Suppress to load "site" module by setting Py_NoSiteFlag before Py_Initialize(),
          >> then load it explicitly.
          >
          > Is loading the "site" module done by all versions of Python, or was it
          > added recently?
          >
          > I suppose that without the "site" module Python cannot do its work?
          >
          >
          > --
          > SOLDIER: What? Ridden on a horse?
          > ARTHUR: Yes!
          > SOLDIER: You're using coconuts!
          > "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD
          >
          > /// Bram Moolenaar -- Bram@... -- http://www.Moolenaar.net \\\
          > /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
          > \\\ an exciting new programming language -- http://www.Zimbu.org ///
          > \\\ help me help AIDS victims -- http://ICCF-Holland.org ///



          --
          MURAOKA Taro <koron.kaoriya@...>

          --
          --
          You received this message from the "vim_dev" maillist.
          Do not top-post! Type your reply below the text you are replying to.
          For more information, visit http://www.vim.org/maillist.php

          ---
          You received this message because you are subscribed to the Google Groups "vim_dev" group.
          To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscribe@....
          For more options, visit https://groups.google.com/d/optout.
        • Taro MURAOKA
          ... I have updated the patch to limit for Python 2.7 or above. Please check attached. -- -- You received this message from the vim_dev maillist. Do not
          Message 4 of 4 , Jul 20, 2014
            Taro MURAOKA:
            > Hi.
            >
            >
            >
            > > Is loading the "site" module done by all versions of Python, or was it
            >
            > > added recently?
            >
            >
            >
            > I don't think all version.
            >
            > But as I can check, python 2.0-7 are loading the "site" module.
            >
            >
            >
            > 2.0 - http://svn.python.org/view/python/branches/release20-maint/Python/pythonrun.c?view=markup
            >
            > 2.2 - http://svn.python.org/view/python/branches/release22-maint/Python/pythonrun.c?view=markup
            >
            > 2.6 - http://svn.python.org/view/python/branches/release26-maint/Python/pythonrun.c?view=markup
            >
            >
            >
            > But it seems that only 2.7 call "exit()" when it failed.
            >
            >
            >
            > > I suppose that without the "site" module Python cannot do its work?
            >
            >
            >
            > Pure Python may be able to work without the "site" module.
            >
            > Python CLI has an option "-S" to disable implicit "site" loading.
            >
            > But most of existing Vim plugins which use Python interface,
            >
            > would expect "site" is loaded implicitly.
            >
            >
            >
            > 2014-07-21 5:05 GMT+09:00 Bram Moolenaar <Bram@...>:
            >
            > >
            >
            > > Taro Muraoka wrote:
            >
            > >
            >
            > >> Hi list and Bram.
            >
            > >>
            >
            > >> I wrote a patch to fix a problem related if_python.
            >
            > >> Please check attached.
            >
            > >>
            >
            > >> Problem:
            >
            > >> When python 2.7 can't find "site" module, vim is exit.
            >
            > >> For example, on Windows which not installed official python 2.7,
            >
            > >> but installed Mecurial or so (py2exe'ed binary),
            >
            > >> Vim will try to load python27.dll of Mercurial,
            >
            > >> but it failed to load "site" module, and exit.
            >
            > >>
            >
            > >> The cause:
            >
            > >> Python try to load "site" module, and if it is failed, call exit().
            >
            > >> See at line 718 in http://svn.python.org/view/python/branches/release27-maint/Python/pythonrun.c?revision=85905&view=markup
            >
            > >>
            >
            > >> Solution:
            >
            > >> Suppress to load "site" module by setting Py_NoSiteFlag before Py_Initialize(),
            >
            > >> then load it explicitly.
            >
            > >
            >
            > > Is loading the "site" module done by all versions of Python, or was it
            >
            > > added recently?
            >
            > >
            >
            > > I suppose that without the "site" module Python cannot do its work?
            >
            > >
            >
            > >
            >
            > > --
            >
            > > SOLDIER: What? Ridden on a horse?
            >
            > > ARTHUR: Yes!
            >
            > > SOLDIER: You're using coconuts!
            >
            > > "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD
            >
            > >
            >
            > > /// Bram Moolenaar -- Bram@... -- http://www.Moolenaar.net \\\
            >
            > > /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
            >
            > > \\\ an exciting new programming language -- http://www.Zimbu.org ///
            >
            > > \\\ help me help AIDS victims -- http://ICCF-Holland.org ///
            >
            >
            >
            >
            >
            >
            >
            > --
            >
            > MURAOKA Taro <koron.kaoriya@...>

            I have updated the patch to limit for Python 2.7 or above.
            Please check attached.

            --
            --
            You received this message from the "vim_dev" maillist.
            Do not top-post! Type your reply below the text you are replying to.
            For more information, visit http://www.vim.org/maillist.php

            ---
            You received this message because you are subscribed to the Google Groups "vim_dev" group.
            To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscribe@....
            For more options, visit https://groups.google.com/d/optout.
          Your message has been successfully submitted and would be delivered to recipients shortly.