• Login
Community
  • Login

Python plugin works in NPP 7.7 but does work in NPP 7.8 upward

Scheduled Pinned Locked Moved Notepad++ & Plugin Development
24 Posts 2 Posters 1.8k Views
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • E
    Ekopalypse
    last edited by Jan 28, 2021, 7:09 PM

    Let me do some tests with your code and the mentioned npp versions.

    1 Reply Last reply Reply Quote 0
    • E
      Ekopalypse
      last edited by Jan 28, 2021, 7:18 PM

      Works for me

      8b16aa0a-e0b6-4f72-ba92-e5895457c5aa-image.png

      Where is your python3.dll located in 7.8?
      Should be within your plugin directory.

      S 1 Reply Last reply Jan 28, 2021, 8:10 PM Reply Quote 2
      • S
        Stier Hahn @Ekopalypse
        last edited by Jan 28, 2021, 8:10 PM

        @Ekopalypse i’ve bin using same setup. I.e. only plugin dll is located in plugin dir. And python dir in path.

        E 1 Reply Last reply Jan 28, 2021, 8:12 PM Reply Quote 2
        • E
          Ekopalypse @Stier Hahn
          last edited by Jan 28, 2021, 8:12 PM

          @Stier-Hahn
          and there is no other python3 dll (64bit) in the path before the 32bit one?

          S 1 Reply Last reply Jan 28, 2021, 8:16 PM Reply Quote 0
          • S
            Stier Hahn @Ekopalypse
            last edited by Stier Hahn Jan 28, 2021, 8:18 PM Jan 28, 2021, 8:16 PM

            @Ekopalypse will check tmr in more details.

            I can tell for sure (99%) I do not have any 64 bit builds of python on my box.

            Ps
            I’m still wondering that it works for me in 7.7 but not in 7.8. Just for my understanding were there any changes that could cause such behavior? Changes in dll lookup order or something

            1 Reply Last reply Reply Quote 0
            • E
              Ekopalypse
              last edited by Jan 28, 2021, 8:17 PM

              Starting from 7.8 plugins are allowed to load their own dlls from within the plugin directory.

              1 Reply Last reply Reply Quote 2
              • E
                Ekopalypse
                last edited by Jan 28, 2021, 8:18 PM

                Ah - could it be that path is not evaluted anymore? I guess so.

                S 1 Reply Last reply Jan 28, 2021, 8:20 PM Reply Quote 1
                • S
                  Stier Hahn @Ekopalypse
                  last edited by Jan 28, 2021, 8:20 PM

                  @Ekopalypse could you please check if it works for you if python dll is located in path and not in plugin dir

                  E 2 Replies Last reply Jan 28, 2021, 8:20 PM Reply Quote 0
                  • E
                    Ekopalypse @Stier Hahn
                    last edited by Jan 28, 2021, 8:20 PM

                    @Stier-Hahn - currently trying

                    E 1 Reply Last reply Jan 28, 2021, 8:22 PM Reply Quote 0
                    • E
                      Ekopalypse @Ekopalypse
                      last edited by Ekopalypse Jan 28, 2021, 8:24 PM Jan 28, 2021, 8:22 PM

                      @Stier-Hahn
                      Yes, it is not found but then I do get

                      6925989c-f96a-49a9-bc06-d9fe35ba80a0-image.png

                      1 Reply Last reply Reply Quote 1
                      • E
                        Ekopalypse
                        last edited by Jan 28, 2021, 8:23 PM

                        and next window is
                        81824459-8282-4997-9a08-23912af2543b-image.png

                        1 Reply Last reply Reply Quote 0
                        • E
                          Ekopalypse
                          last edited by Jan 28, 2021, 8:24 PM

                          but npp 7.7 works.

                          1 Reply Last reply Reply Quote 1
                          • E
                            Ekopalypse @Stier Hahn
                            last edited by Jan 28, 2021, 8:26 PM

                            @Stier-Hahn

                            I start to remember that I read some conversation about
                            security concerns regarding sideloading dlls.

                            S 1 Reply Last reply Jan 29, 2021, 9:46 AM Reply Quote 1
                            • S
                              Stier Hahn @Ekopalypse
                              last edited by Jan 29, 2021, 9:46 AM

                              @Ekopalypse so, I’ve tested my minimal plugin build in 7.8 with python37.dll inside plugin dir and it works.

                              My question from the top of the thread has been solved.

                              Thank you very much!

                              ps

                              I still need to check if my main plugin will be working…
                              Struggling to upgrade third-party libs and other dependencies…

                              1 Reply Last reply Reply Quote 2
                              • E
                                Ekopalypse
                                last edited by Jan 29, 2021, 11:18 AM

                                If there is anything we can do to help let us know.

                                S 1 Reply Last reply Jan 29, 2021, 4:00 PM Reply Quote 0
                                • S
                                  Stier Hahn @Ekopalypse
                                  last edited by Stier Hahn Jan 29, 2021, 4:03 PM Jan 29, 2021, 4:00 PM

                                  @Ekopalypse you are doing great job , thank you !

                                  ps
                                  I came across a next roadblock , that’s more a pywin32 issue.

                                  See https://github.com/mhammond/pywin32/issues/1658

                                  May be you would have a hint how to troubleshoot that. as that seems to be sort of related to dependency lookup process.

                                  In a nutshell I’ve NPP plugin linked against boost::python which loads at startup some initialization python code. And it’s was working fine under py 3.7 and npp 7.7.

                                  Finally ( with your help) I managed to upgrade npp from 7.7 to 7.9
                                  and partially from winpython 3.7 to winpython 3.8.

                                  My NPP python plugin is loaded at startup, but execution of initialsation python scripts fails to import win32api.
                                  Embedded python wrapper is working fine ( I guess ) as import os / import sys and other simple code is working inside my plugin.

                                  I’m using win py 3.8 and latest pywin32 ( 300)

                                  S 1 Reply Last reply Jan 29, 2021, 4:04 PM Reply Quote 0
                                  • S
                                    Stier Hahn @Stier Hahn
                                    last edited by Jan 29, 2021, 4:04 PM

                                    @Stier-Hahn pywin32 is installed sort of correctly as it works from python command line.

                                    E 1 Reply Last reply Jan 29, 2021, 6:59 PM Reply Quote 0
                                    • E
                                      Ekopalypse @Stier Hahn
                                      last edited by Jan 29, 2021, 6:59 PM

                                      @Stier-Hahn

                                      there is an additional
                                      ...\AppData\Roaming\Python\Python38\site-packages
                                      path when used by the command line.
                                      Maybe give it a try to add it to your sys.path from embedded python.

                                      Do you know procmon ?
                                      It could be used to see what npp and your plugin tries to load with a filter set to path contains whatever

                                      48b96c60-c947-48f4-9987-af19cf359c3d-image.png

                                      If importing pywin32 failed with unable to load dll
                                      then one of those
                                      2f2d6355-c2f6-4c2c-b92d-c49ef97d7714-image.png
                                      can not be found I guess.
                                      python38 shouldn’t be the problem but pywintypes38.dll might be in this additional path I’ve mentioned earlier??

                                      S 1 Reply Last reply Jan 30, 2021, 6:41 AM Reply Quote 2
                                      • S
                                        Stier Hahn @Ekopalypse
                                        last edited by Stier Hahn Jan 30, 2021, 6:41 AM Jan 30, 2021, 6:41 AM

                                        @Ekopalypse cool, thanks for advice, turned out to be pywin32_system32 not being searched for some reason

                                        Untitled.png
                                        Apparently lookup path was (intentionally screwed up) modified

                                        I managed to fix my problem by placing pywintypes38.dll and pythoncom38.dll to NPP root

                                        1 Reply Last reply Reply Quote 2
                                        15 out of 24
                                        • First post
                                          15/24
                                          Last post
                                        The Community of users of the Notepad++ text editor.
                                        Powered by NodeBB | Contributors