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

Re: Python plugin using PyWin32

Expand Messages
  • Roland Puntaier
    ... Is the directory where the Win32API DLLs are in the Windows environment variable PATH? If not, please try to add it there and restart VIM. Do the same also
    Message 1 of 11 , Jul 2 2:45 AM
    • 0 Attachment
      On 06/30/2011 04:35 PM, Alexandre Martani wrote:
      > I am trying to use Vim R plugin [1], which is a Python plugin that
      > uses PyWin32 on Windows. I have installed Python 2.7.1 and PyWin32. It
      > is installed correctly, as I am able to do a "import win32api" from
      > python shell without errors. But, on GVim, if I do:
      >
      > :python import win32api
      >
      > I receive the following error:
      >
      > Traceback (most recent call last):
      > File "<string>", line 1, in <module>
      > ImportError: DLL load failed: The specified module could not be found.

      Is the directory where the Win32API DLLs are in the Windows environment
      variable PATH?
      If not, please try to add it there and restart VIM. Do the same also for
      the R DLLs.
      By the way: I wasn't aware of this VIM R plugin. I like R-Project and
      VIM. So this is a good fit.

      Regards, Roland

      --
      You received this message from the "vim_use" 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
    • Alexandre Martani
      ... The module works when used directly from the Python shell (only fails from Gvim). I have checked os.environ[ PATH ] from both instances, and they are
      Message 2 of 11 , Jul 4 10:47 AM
      • 0 Attachment
        On 7/2/2011 6:45 AM, Roland Puntaier wrote:
        > On 06/30/2011 04:35 PM, Alexandre Martani wrote:
        >> I am trying to use Vim R plugin [1], which is a Python plugin that
        >> uses PyWin32 on Windows. I have installed Python 2.7.1 and PyWin32.
        >> It is installed correctly, as I am able to do a "import win32api"
        >> from python shell without errors. But, on GVim, if I do:
        >>
        >> :python import win32api
        >>
        >> I receive the following error:
        >>
        >> Traceback (most recent call last):
        >> File "<string>", line 1, in <module>
        >> ImportError: DLL load failed: The specified module could not be found.
        >
        > Is the directory where the Win32API DLLs are in the Windows
        > environment variable PATH?
        > If not, please try to add it there and restart VIM. Do the same also
        > for the R DLLs.
        > By the way: I wasn't aware of this VIM R plugin. I like R-Project and
        > VIM. So this is a good fit.
        >
        > Regards, Roland
        >

        The module works when used directly from the Python shell (only fails
        from Gvim). I have checked os.environ["PATH"] from both instances, and
        they are basically equal (they both includes "C:\Python2.7"), so I think
        this is not the problem. Is there any other paths Windows uses to search
        its DLLs?

        Alexandre

        --
        You received this message from the "vim_use" 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
      • Roland Puntaier
        ... Maybe this helps: http://stackoverflow.com/questions/214852/python-module-dlls Regards, Roland -- You received this message from the vim_use maillist. Do
        Message 3 of 11 , Jul 5 7:49 AM
        • 0 Attachment
          On 07/04/2011 07:47 PM, Alexandre Martani wrote:
          > On 7/2/2011 6:45 AM, Roland Puntaier wrote:
          >> On 06/30/2011 04:35 PM, Alexandre Martani wrote:
          >>> I am trying to use Vim R plugin [1], which is a Python plugin that
          >>> uses PyWin32 on Windows. I have installed Python 2.7.1 and PyWin32.
          >>> It is installed correctly, as I am able to do a "import win32api"
          >>> from python shell without errors. But, on GVim, if I do:
          >>>
          >>> :python import win32api
          >>>
          >>> I receive the following error:
          >>>
          >>> Traceback (most recent call last):
          >>> File "<string>", line 1, in <module>
          >>> ImportError: DLL load failed: The specified module could not be found.
          >>
          >> Is the directory where the Win32API DLLs are in the Windows
          >> environment variable PATH?
          >> If not, please try to add it there and restart VIM. Do the same also
          >> for the R DLLs.
          >> By the way: I wasn't aware of this VIM R plugin. I like R-Project and
          >> VIM. So this is a good fit.
          >>
          >> Regards, Roland
          >>
          >
          > The module works when used directly from the Python shell (only fails
          > from Gvim). I have checked os.environ["PATH"] from both instances, and
          > they are basically equal (they both includes "C:\Python2.7"), so I
          > think this is not the problem. Is there any other paths Windows uses
          > to search its DLLs?
          >
          > Alexandre
          >
          Maybe this helps:
          http://stackoverflow.com/questions/214852/python-module-dlls

          Regards, Roland

          --
          You received this message from the "vim_use" 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
        • Alexandre Martani
          ... roject and ... I tried to add a lot of paths, but I am still getting this error. ... C: Python27 C: Python27 Scripts C: WINDOWS system32 C: WINDOWS
          Message 4 of 11 , Jul 6 7:35 AM
          • 0 Attachment
            On Tuesday, July 05, 2011 11:49:30 AM, Roland Puntaier wrote:
            > On 07/04/2011 07:47 PM, Alexandre Martani wrote:
            >> On 7/2/2011 6:45 AM, Roland Puntaier wrote:
            >>> On 06/30/2011 04:35 PM, Alexandre Martani wrote:
            >>>> I am trying to use Vim R plugin [1], which is a Python plugin that
            >>>> uses PyWin32 on Windows. I have installed Python 2.7.1 and PyWin32.
            >>>> It is installed correctly, as I am able to do a "import win32api"
            >>>> from python shell without errors. But, on GVim, if I do:
            >>>>
            >>>> :python import win32api
            >>>>
            >>>> I receive the following error:
            >>>>
            >>>> Traceback (most recent call last):
            >>>> File "<string>", line 1, in <module>
            >>>> ImportError: DLL load failed: The specified module could not be found.
            >>>
            >>> Is the directory where the Win32API DLLs are in the Windows
            >>> environment variable PATH?
            >>> If not, please try to add it there and restart VIM. Do the same also
            >>> for the R DLLs.
            >>> By the way: I wasn't aware of this VIM R plugin. I like R-P
            roject and
            >>> VIM. So this is a good fit.
            >>>
            >>> Regards, Roland
            >>>
            >>
            >> The module works when used directly from the Python shell (only fails
            >> from Gvim). I have checked os.environ["PATH"] from both instances, and
            >> they are basically equal (they both includes "C:\Python2.7"), so I
            >> think this is not the problem. Is there any other paths Windows uses
            >> to search its DLLs?
            >>
            >> Alexandre
            >>
            > Maybe this helps:
            > http://stackoverflow.com/questions/214852/python-module-dlls
            >
            > Regards, Roland

            I tried to add a lot of paths, but I am still getting this error.

            :python print "\n".join(os.environ["PATH"].split(";"))

            C:\Python27\
            C:\Python27\Scripts
            C:\WINDOWS\system32
            C:\WINDOWS
            C:\WINDOWS\System32\Wbem
            C:\WINDOWS\system32\WindowsPowerShell\v1.0
            C:\Python27
            C:\Program Files\TortoiseSVN\bin
            %APPDATA%\Python\Scripts
            C:\Program Files\Vim\vim73
            C:\Python27\Lib\site-packages\win32
            C:\Python27\Lib\site-packages\win32\lib
            C:\Python27\Lib\site-packages\pywin32_system32

            C:\Python27\Lib\site-packages\win32
            C:\Python27\Lib\site-packages

            Any other idea of paths which could be missing?

            --
            You received this message from the "vim_use" 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
          • Vlad Irnov
            On Jun 30, 10:35 am, Alexandre Martani ... I cannot reproduce your problem on my system: Win2k; Vim 7.3.145; Python 2.6.5;
            Message 5 of 11 , Jul 6 3:35 PM
            • 0 Attachment
              On Jun 30, 10:35 am, Alexandre Martani <alexandre.mart...@...>
              wrote:
              > Hello all,
              >
              > I am trying to use Vim R plugin [1], which is a Python plugin that uses
              > PyWin32 on Windows. I have installed Python 2.7.1 and PyWin32. It is
              > installed correctly, as I am able to do a "import win32api" from python
              > shell without errors. But, on GVim, if I do:
              >
              > :python import win32api
              >
              > I receive the following error:
              >
              > Traceback (most recent call last):
              >      File "<string>", line 1, in <module>
              > ImportError: DLL load failed: The specified module could not be found.
              >
              > Notice that this is not the standard error for module not found ("No
              > module named x"). It is probably related to the path python uses for its
              > DLL modules. I have played with sys.path, but without success.

              I cannot reproduce your problem on my system:
              Win2k; Vim 7.3.145; Python 2.6.5; pywin32-214.win32-py2.6.exe
              installed
              My PATH has Python's top level directory "C:\Python" where it's
              installed and no subdirs or other Python-related stuff.

              Some ideas:

              1) Try after launching Vim with
              "C:\Program Files\Vim\vim73\gvim.exe" -u NONE -U NONE

              2) Examine sys.path from Vim
              :py import sys; print sys.path
              I have these
              'C:\\Python\\lib\\site-packages'
              'C:\\Python\\lib\\site-packages\\win32'
              'C:\\Python\\lib\\site-packages\\win32\\lib'
              'C:\\Python\\lib\\site-packages\\Pythonwin'

              3) Perhaps you have several conflicting versions of Python or PyWin32
              installed? 32- vs 64-bit?

              4) Did you install PyWin as Admin? If not, try to reinstall.


              > I also noticed the first path in sys.path is "C:\\must>not&exist", which
              > is probably a bug. Don't know if this could be related, but I tried do a
              > sys.path.pop(0), and it didn't work.

              It used to be an empty string. It was changed to this bogus path for
              some security reasons:
              http://ftp.nluug.nl/vim/patches/7.2/7.2.045

              --
              You received this message from the "vim_use" 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
            • Alexandre Martani
              ... alled ... Same problem. ... I have removed all versions of Python and removed folders C:/Python2.7. I also tried to use ActivePython, as in my experiences
              Message 6 of 11 , Jul 7 1:40 PM
              • 0 Attachment
                On Wednesday, July 06, 2011 7:35:21 PM, Vlad Irnov wrote:
                > On Jun 30, 10:35 am, Alexandre Martani<alexandre.mart...@...>
                > wrote:
                >> Hello all,
                >>
                >> I am trying to use Vim R plugin [1], which is a Python plugin that uses
                >> PyWin32 on Windows. I have installed Python 2.7.1 and PyWin32. It is
                >> installed correctly, as I am able to do a "import win32api" from python
                >> shell without errors. But, on GVim, if I do:
                >>
                >> :python import win32api
                >>
                >> I receive the following error:
                >>
                >> Traceback (most recent call last):
                >> File "<string>", line 1, in<module>
                >> ImportError: DLL load failed: The specified module could not be found.
                >>
                >> Notice that this is not the standard error for module not found ("No
                >> module named x"). It is probably related to the path python uses for its
                >> DLL modules. I have played with sys.path, but without success.
                >
                > I cannot reproduce your problem on my system:
                > Win2k; Vim 7.3.145; Python 2.6.5; pywin32-214.win32-py2.6.exe
                > inst
                alled
                > My PATH has Python's top level directory "C:\Python" where it's
                > installed and no subdirs or other Python-related stuff.
                >
                > Some ideas:
                >
                > 1) Try after launching Vim with
                > "C:\Program Files\Vim\vim73\gvim.exe" -u NONE -U NONE

                Same problem.

                > 2) Examine sys.path from Vim
                > :py import sys; print sys.path
                > I have these
                > 'C:\\Python\\lib\\site-packages'
                > 'C:\\Python\\lib\\site-packages\\win32'
                > 'C:\\Python\\lib\\site-packages\\win32\\lib'
                > 'C:\\Python\\lib\\site-packages\\Pythonwin'
                >
                > 3) Perhaps you have several conflicting versions of Python or PyWin32
                > installed? 32- vs 64-bit?
                >
                > 4) Did you install PyWin as Admin? If not, try to reinstall.

                I have removed all versions of Python and removed folders C:/Python2.7.
                I also tried to use ActivePython, as in my experiences it fixes some
                problems with windows paths, but none of them worked. Someone using
                Python 2.7 there? I can try later to install Python 2.6.

                >> I also noticed the first path in sys.pat
                h is "C:\\must>not&exist", which
                >> is probably a bug. Don't know if this could be related, but I tried do a
                >> sys.path.pop(0), and it didn't work.
                >
                > It used to be an empty string. It was changed to this bogus path for
                > some security reasons:
                > http://ftp.nluug.nl/vim/patches/7.2/7.2.045

                It was changed, but I suppose from the path that it should have been
                removed later:

                + /* Remove the element from sys.path that was added because of our
                + * argv[0] value in PythonMod_Init(). Previously we used an empty
                + * string, but dependinding on the OS we then get an empty entry or
                + * the current directory in sys.path. */
                + PyRun_SimpleString("import sys; sys.path = filter(lambda x: x !=
                '/must>not&exist', sys.path)");

                I think it is not being removed because Python on Windows changes it to
                'C:\\must>not&exist'.


                --
                You received this message from the "vim_use" 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
              • Vlad Irnov
                On Jul 7, 4:40 pm, Alexandre Martani ... I should mention that I installed Vim from sources. I compiled gvim.exe and vim.exe
                Message 7 of 11 , Jul 7 7:50 PM
                • 0 Attachment
                  On Jul 7, 4:40 pm, Alexandre Martani <alexandre.mart...@...>
                  wrote:
                  > On Wednesday, July 06, 2011 7:35:21 PM, Vlad Irnov wrote:
                  > > On Jun 30, 10:35 am, Alexandre Martani<alexandre.mart...@...>
                  > > wrote:
                  > >> Hello all,
                  >
                  > >> I am trying to use Vim R plugin [1], which is a Python plugin that uses
                  > >> PyWin32 on Windows. I have installed Python 2.7.1 and PyWin32. It is
                  > >> installed correctly, as I am able to do a "import win32api" from python
                  > >> shell without errors. But, on GVim, if I do:
                  >
                  > >> :python import win32api
                  >
                  > >> I receive the following error:
                  >
                  > >> Traceback (most recent call last):
                  > >>       File "<string>", line 1, in<module>
                  > >> ImportError: DLL load failed: The specified module could not be found.
                  >
                  > >> Notice that this is not the standard error for module not found ("No
                  > >> module named x"). It is probably related to the path python uses for its
                  > >> DLL modules. I have played with sys.path, but without success.
                  >
                  > > I cannot reproduce your problem on my system:
                  > > Win2k; Vim 7.3.145; Python 2.6.5; pywin32-214.win32-py2.6.exe
                  > > inst
                  > alled
                  > > My PATH has Python's top level directory "C:\Python" where it's
                  > > installed and no subdirs or other Python-related stuff.

                  I should mention that I installed Vim from sources. I compiled
                  gvim.exe and vim.exe with MinGW (GCC), with Python 2.6 support only,
                  no Python 3. In contrast, your version output shows your Vim was
                  probably built with Microsoft VC toolkit (or whatever it is called).
                  It is possible that it does not play nice with PyWin32. It also has
                  support for both Python 2.7 and 3.1. May be these two clash somehow.

                  I suggest you compile your own gvim.exe and/or vim.exe as per my
                  instructions:
                  http://vim.wikia.com/wiki/Build_Python-enabled_Vim_on_Windows_with_MinGW?useskin=monobook

                  If that helps, then it's a Vim bug.
                  You can also try to find a differently built version of Vim but you
                  have to make sure it supports Python 2.7. The Cream version needs
                  Python 2.6.



                  > >> I also noticed the first path in sys.pat
                  >
                  > h is "C:\\must>not&exist", which
                  >
                  > >> is probably a bug. Don't know if this could be related, but I tried do a
                  > >> sys.path.pop(0), and it didn't work.
                  >
                  > > It used to be an empty string. It was changed to this bogus path for
                  > > some security reasons:
                  > >http://ftp.nluug.nl/vim/patches/7.2/7.2.045
                  >
                  > It was changed, but I suppose from the path that it should have been
                  > removed later:
                  >
                  > +       /* Remove the element from sys.path that was added because of our
                  > +        * argv[0] value in PythonMod_Init().  Previously we used an empty
                  > +        * string, but dependinding on the OS we then get an empty entry or
                  > +        * the current directory in sys.path. */
                  > +       PyRun_SimpleString("import sys; sys.path = filter(lambda x: x !=
                  > '/must>not&exist', sys.path)");
                  >
                  > I think it is not being removed because Python on Windows changes it to
                  > 'C:\\must>not&exist'.

                  You are probably right that it should be removed. It's not going to
                  cause any problems though. Such nonexistent directories are ignored.

                  --
                  You received this message from the "vim_use" 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
                Your message has been successfully submitted and would be delivered to recipients shortly.