• Login
Community
  • Login

sort file removing duplicates possible?

Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
75 Posts 5 Posters 61.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.
  • P
    patrickdrd
    last edited by Jun 2, 2018, 3:34 PM

    I can’t find either D:\Utilities\PortableApps\Notepad++\plugins\PythonScript\lib\lib-tk or D:\Utilities\PortableApps\Notepad++\lib folder in explorer!

    C 1 Reply Last reply Jun 2, 2018, 3:58 PM Reply Quote 0
    • C
      Claudia Frank @patrickdrd
      last edited by Jun 2, 2018, 3:58 PM

      so how did you install Tcl/Tk libraries?

      Cheers
      Claudia

      1 Reply Last reply Reply Quote 0
      • P
        patrickdrd
        last edited by Jun 2, 2018, 4:01 PM

        I extracted the zip of course, the folder you say is in:
        d:\Utilities\PortableApps\Notepad++\plugins\PythonScript\lib\tcl\lib-tk\

        both in zip file and my explorer!

        1 Reply Last reply Reply Quote 0
        • P
          patrickdrd
          last edited by Jun 2, 2018, 4:22 PM

          I’ve just read guy038’s post and I’m more confused :S

          I downloaded the file again and now it’s Last modified: 02 Jun 2018 16:00 UTC
          and 69930 results,
          sorting with insensitive (ue and textfx) yields 69284 and the output should be similar,
          so I should be satisfied by that consensus I guess?

          C 1 Reply Last reply Jun 2, 2018, 4:34 PM Reply Quote 0
          • C
            Claudia Frank @patrickdrd
            last edited by Jun 2, 2018, 4:34 PM

            @patrickdrd

            the easylist file is adblocker file it will change consistently.

            Regarding the Tcl/Tk installation - you should have unzipped it into
            D:\Utilities\PortableApps\Notepad++\ directory.

            The zip contains the complete folder hierachy - as you see on the left side (archive tree)

            if you did this you normally got a message saying that the plugins folder already exists and
            if you want it to overwrite -> you should have answered this with yes, didn’t you?

            Cheers
            Claudia

            1 Reply Last reply Reply Quote 0
            • P
              patrickdrd
              last edited by Jun 2, 2018, 4:37 PM

              yep, that’s what I got https://imgur.com/a/xNQB5Gn

              C 1 Reply Last reply Jun 2, 2018, 5:36 PM Reply Quote 0
              • C
                Claudia Frank @patrickdrd
                last edited by Jun 2, 2018, 5:36 PM

                @patrickdrd

                took some time to understand the difference.
                You do have
                …\Notepad++\plugins\PythonScript\lib\tcl\lib-tk
                where I do have
                …\Notepad++\plugins\PythonScript\lib\lib-tk

                so the error makes sense as it can’t be found in …\lib\lib-tk

                You could try to add the following to your user startup.py script

                import sys
                sys.path.append(r'D:\Utilities\PortableApps\Notepad++\plugins\PythonScript\lib\tcl\lib-tk')
                

                and restart npp and do another import Tkinter test.

                Cheers
                Claudia

                1 Reply Last reply Reply Quote 0
                • P
                  patrickdrd
                  last edited by Jun 2, 2018, 6:25 PM

                  ok thanks, first thing tomorrow with the morning coffee
                  :-D

                  1 Reply Last reply Reply Quote 0
                  • G
                    guy038
                    last edited by guy038 Jun 2, 2018, 6:44 PM Jun 2, 2018, 6:41 PM

                    Hi, @patrickdrd, and All,

                    Just for info, doing again my tests ( Last modified: 02 Jun 2018 17:23 UTC ) with N++ sort, followed by the regex S/R, I obtained :

                    • Original file : 69931 lines

                    • With regex A ( sensitive ) : 69852 lines ( so, 65 lines deleted, in 56 matches )

                    • With regex B ( insensitive ) : 69817 lines ( so, 100 lines deleted, in 88 matches )

                    • With TextFX sort, at column 1, with the option Sort outputs only UNIQUE (at column) lines, it produced a 69285 lines file ( so, 646 lines deleted )


                    Now, @patrickdrd, I don’t want you to be confused, with my explanations ! I just pointed out the fact that depending of the different ways and softwares, used to remove duplicates lines, you must expect different results ! My solution using first, N++ sort and , secondly, a regex S/R may not give the correct results, because it’s based on comparing consecutive lines, previously sorted !

                    And , probably, the TextFX plugin, ( whose I don’t know the sort logic ! ) other software, and the last sorter.py script, from @claudia-frank, will produce best results :-))

                    Finally, I’m thinking that a correct script to delete duplicates lines should not rely on any sort and just compares two individual lines, at a time ! In other words, any line should simply be compared, successively, with each other line of the file !

                    Cheers,

                    guy038

                    P.S. :

                    BTW, I confirm that the TextFX sort tool, as N++ sort, seems stable : after running it 5 times, the ouput files, produced , are totally identical :-)

                    1 Reply Last reply Reply Quote 0
                    • P
                      patrickdrd
                      last edited by Jun 3, 2018, 7:12 AM

                      @Claudia-Frank still doesn’t work:

                      File “<console>”, line 1, in <module>
                      File “D:\Utilities\PortableApps\Notepad++\plugins\PythonScript\lib\tcl\lib-tk\Tkinter.py ”, line 39, in <module>
                      import _tkinter # If this fails your Python may not be configured for Tk
                      ImportError: No module named _tkinter

                      C 1 Reply Last reply Jun 3, 2018, 8:12 PM Reply Quote 0
                      • C
                        Claudia Frank @patrickdrd
                        last edited by Claudia Frank Jun 3, 2018, 8:13 PM Jun 3, 2018, 8:12 PM

                        @patrickdrd

                        can you please run the following code in the python script console and check the output?

                        import os; print '\n'.join(os.listdir(r'plugins\PythonScript\lib\tcl'))
                        

                        If you have something similar to me

                        dde1.3
                        lib-tk     <--- this is important
                        reg1.2
                        tcl
                        tcl8
                        tcl8.5
                        tcl85x.dll     <--- this is important
                        tcl85x.lib
                        tclConfig.sh
                        tclpip85x.dll     <--- this is important
                        tclstub85.lib
                        tk8.5
                        tk85x.dll     <--- this is important
                        tk85x.lib
                        tkstub85.lib
                        _tkinter.pyd     <--- this is important
                        

                        you have to add another path to sys.path so that you have the following in your startup.py

                        import sys
                        sys.path.append(r'D:\Utilities\PortableApps\Notepad++\plugins\PythonScript\lib\tcl')	
                        sys.path.append(r'D:\Utilities\PortableApps\Notepad++\plugins\PythonScript\lib\tcl\lib-tk')	
                        

                        After restarting notepad++, PS should be able to use Tkinter to build windows.
                        If you don’t have the dlls etc… or it is still not working, can you please post the output from the os.listdir… ?

                        Cheers
                        Claudia

                        1 Reply Last reply Reply Quote 0
                        • P
                          patrickdrd
                          last edited by Jun 4, 2018, 5:16 AM

                          still not

                          dde1.3
                          lib-tk
                          reg1.2
                          tcl
                          tcl8
                          tcl8.5
                          tclConfig.sh
                          tk8.5
                          _tkinter.pyd

                          1 Reply Last reply Reply Quote 0
                          • P
                            patrickdrd
                            last edited by patrickdrd Jun 4, 2018, 5:42 AM Jun 4, 2018, 5:41 AM

                            import worked but sorter not:

                            Traceback (most recent call last):
                            File “D:\Utilities\PortableApps\Notepad++\plugins\PythonScript\scripts\Sorter.py ”, line 110, in <module>
                            SorterWindow()
                            File “D:\Utilities\PortableApps\Notepad++\plugins\PythonScript\scripts\Sorter.py ”, line 76, in init
                            self.window = tk.Tk ()
                            File “D:\Utilities\PortableApps\Notepad++\plugins\PythonScript\lib\tcl\lib-tk\Tkinter.py ”, line 1819, in init
                            self.tk = _tkinter.create(screenName, baseName, className, interactive, wantobjects, useTk, sync, use)
                            _tkinter.TclError: Can’t find a usable init.tcl in the following directories:
                            D:/Utilities/PortableApps/Notepad++/plugins/PythonScript/lib/lib/tcl8.5 D:/Utilities/PortableApps/lib/tcl8.5 D:/Utilities/lib/tcl8.5 D:/Utilities/PortableApps/library D:/Utilities/library D:/Utilities/tcl8.5.2/library D:/tcl8.5.2/library

                            This probably means that Tcl wasn’t installed properly.

                            what’s that double lib in the first path?

                            1 Reply Last reply Reply Quote 0
                            • P
                              patrickdrd
                              last edited by Jun 4, 2018, 11:18 AM

                              maybe we should quit?

                              I’ll be using textfx’s (insensitive) sort and tcl/tkinter seems so unbelievably awkward to setup!

                              C 1 Reply Last reply Jun 4, 2018, 11:43 AM Reply Quote 0
                              • C
                                Claudia Frank @patrickdrd
                                last edited by Jun 4, 2018, 11:43 AM

                                Hi Patrick,

                                maybe we should quit?

                                For the time being, you are right.
                                The tcl/tk packages as well as python script internally do have
                                an issue which needs to be solved. I can’t say when but it should be solved
                                in near future.

                                I will keep you updated once I successfully tested with a fixed version of
                                the tcl/tk packages in this thread, if you want.

                                Then, hopefully, it should be just a matter of unzipping the packages
                                to the right folder and setting the appropriate paths.

                                Cheers
                                Claudia

                                1 Reply Last reply Reply Quote 1
                                • P
                                  patrickdrd
                                  last edited by Jun 4, 2018, 11:45 AM

                                  yes, of course, I’m interested,

                                  maybe you should zip your own folder (and files) regarding tcl and upload it somewhere for me to download? because I saw there are inconsistencies between different tcl zip downloads

                                  C 1 Reply Last reply Jun 4, 2018, 11:52 AM Reply Quote 0
                                  • C
                                    Claudia Frank @patrickdrd
                                    last edited by Jun 4, 2018, 11:52 AM

                                    @patrickdrd

                                    I’m running a modified 64bit version (one of the reasons I didn’t notice that a clean
                                    install does have issues) which uses modified versions of packages so I assume this isn’t
                                    really a solution but might be another source of confusion.

                                    I’m in contact with @chcg - let’s see what we can do to get this fixed soon.

                                    Cheers
                                    Claudia

                                    S 1 Reply Last reply Jun 4, 2018, 12:57 PM Reply Quote 1
                                    • S
                                      Scott Sumner @Claudia Frank
                                      last edited by Jun 4, 2018, 12:57 PM

                                      @Claudia-Frank @patrickdrd

                                      Just sayin’ : The fact that the script uses Tk caused me no problems – works great! Thanks @Claudia-Frank !!

                                      1 Reply Last reply Reply Quote 1
                                      • V
                                        Vasile Caraus
                                        last edited by Jun 4, 2018, 7:21 PM

                                        ^([A-Z])([a-z]+)\R(?i:\1)\2$

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