Community
    • Login

    RFC / Beta Testers Wanted: pyscFilteredViewer

    Scheduled Pinned Locked Moved General Discussion
    53 Posts 7 Posters 12.6k 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.
    • PeterJonesP
      PeterJones
      last edited by

      @Alan-Kilborn ,

      I keep thinking about how it might be similar to or different from Don’s porcine offering: https://github.com/npp-plugins/pork2sausage

      Thanks for that. Yeah, they are similar. The primary difference is that mine doesn’t replace the source file. For one of my primary use cases – rending the POD from inside my Perl code into an HTML document – it would be rather destructive to the Perl code to have it be replaced by HTML. :-)

      1 Reply Last reply Reply Quote 1
      • chcgC
        chcg
        last edited by

        @Peter-Jones I added it as addon example to https://github.com/bruderstein/PythonScript. Hope that is ok for your.

        1 Reply Last reply Reply Quote 1
        • PeterJonesP
          PeterJones
          last edited by PeterJones

          v0.02-beta has been released.

          • per #5, add an ExampleConverterCommand.bat, update the default pyscFilteredViewer.ini file to have valid filter defined using that batch file, so now there is a working filter out-of-the-box.
          • per #4, simplify the installation instructions, moving the alternate-situations to separate documentation

          Also, per @Alan-Kilborn , I made a brief mention of how it differs from pork2sausage

          @chcg: as I meant to imply by my upvote, I’m fine with you linking to it from PythonScript. I’m a little surprised there’s only two “interesting addon scripts” in the universe right now. :-) I guess you cannot just link to every wonderful script that @Claudia-Frank (or any other PythonScript contributor) posted to this Community… though probably some of her gists would be worth linking to.

          1 Reply Last reply Reply Quote 3
          • guy038G
            guy038
            last edited by guy038

            Hello, @peterjones and All,

            I’ve just tried your pyscFilteredViewer and everything went fine ! Well…, as long as if I’ve already started my browser !

            Indeed, if I use the One-time filtering mode, on my weak XP configuration, the temporary file <Hex number>.<filename>.FILTERED.html seems already deleted… by the time the browser gets opened, leading, for instance, to the browser message( in French, of course ) :

            " Firefox cannot find the file at the address /c:/docume~1/guy/locals~1/temp/37B82996.Test.txt.FILTERED.html "

            Luckily, subsequent tests seem OK. I’m saying “seem” and not “are”, as yesterday, Notepad++ crashed several times ! Unfortunately, I could not understand the sequence of actions which causes N++ to crash, when using your script !

            Today, once my browser opened ( while listening music on NET, too ! ) , I tried to run your script, successively, on the same file ( Your README.md file ) => Sometimes it’s opened, correctly, in the browser but in some other cases, it displays :

            " Firefox cannot find the file at the address /c:/docume~1/guy/locals~1/temp/2BF64FA9.README.md.FILTERED.html "

            Moreover, in a few cases, it, also, exits Notepad++, immediately !

            An another time, on the Python console, this error occurred :

            File “D:@@\763\plugins\Config\PythonScript\scripts\pyscFilteredViewer\pyscFilteredViewerLibrary.py”, line 312, in pyscfv_FilteredViewer
            os.unlink(tmpfile)

            WindowsError: [Error 32] The process cannot access the file as this file is used by an other process : ‘c:\docume~1\guy\locals~1\temp\2BF64FA9.README.md.FILTERED.html’

            I noticed that, if I’m not listening simultaneously music on WEB, it’s getting better : no more error occurs and the browser seems to display the HTML version of files, a bit quicker !

            So, Peter, don’t worry about it. Probably, some side-effects of my old XP machine :-))

            Best Regards,

            guy038

            For the record, in the pyscFilteredViewer.ini file, I only added the section, below :

            [Txtfile]
            Language=Normal text
            Extension=.txt .md .log
            Command="D:\@@\763\plugins\Config\PythonScript\scripts\pyscFilteredViewer\ExampleConverterCommand.bat" "%1"
            

            And here is my Debug info :

            Notepad++ v7.6.3   (32-bit)
            Build time : Jan 27 2019 - 17:20:30
            Path : D:\@@\763\notepad++.exe
            Admin mode : OFF
            Local Conf mode : ON
            OS : Windows XP (32-bit)
            Plugins : DSpellCheck.dll mimeTools.dll NppConverter.dll NppExport.dll PythonScript.dll 
            
            Meta ChuhM 1 Reply Last reply Reply Quote 2
            • PeterJonesP
              PeterJones
              last edited by

              @guy038,

              Thanks, that’s actually quite useful: I probably should just leave the temporary files there, rather than deleting every time. (The auto-delete was a holdover from when I used a random tmpfile name, before I had the FilterOnSave option.)

              As for the crash: it’s probably the same issue @Eko-palypse had with crashing. So far, 7.6.2 64-b on Win7 and 7.6.3 32-bit on XP see the crashes, whereas my 7.6.4 64-bit on Win10 does not. Maybe it is an older-windows thing. Since I don’t have access to Win7 or earlier machines, that will be hard for me to test. Maybe I’ll have to look into “if OS<Win10, don’t use the command eko noticed”… I’ll have to research how to look up Windows-rev in Python.

              Meta ChuhM 1 Reply Last reply Reply Quote 1
              • Eko palypseE
                Eko palypse
                last edited by

                @Peter-Jones
                Still strange this crashes - I will setup a Windows10 in VirtualBox and see if I can get the same
                result as you have. If so, I guess it’s time to upgrade - Win7 comes to end anyway.

                Meta ChuhM 1 Reply Last reply Reply Quote 2
                • Meta ChuhM
                  Meta Chuh moderator @guy038
                  last edited by Meta Chuh

                  @guy038 @PeterJones and all

                  seems already deleted… by the time the browser gets opened

                  true, even if it has been rendered in time before it gets deleted, the auto deletion also makes it impossible to view the source code of a rendered html by right clicking on the rendered page.

                  1 Reply Last reply Reply Quote 1
                  • Meta ChuhM
                    Meta Chuh moderator @PeterJones
                    last edited by Meta Chuh

                    @PeterJones said:

                    I probably should just leave the temporary files there, rather than deleting every time.

                    one possibility to avoid cluttering of old temp files, could be not to delete the current temp file at the end of the script, but to delete all pyscfr temp files at the beginning of the script, once a new html has been rendered.
                    this would leave them there until a new rendering is executed, and not fill up %temp%

                    another possibility could be to use a static file name for the rendered html, and never delete it (it would simply be overwritten everytime a new render has been done, and the file name would always be the same

                    1 Reply Last reply Reply Quote 1
                    • Meta ChuhM
                      Meta Chuh moderator @Eko palypse
                      last edited by Meta Chuh

                      @Eko-palypse

                      Still strange this crashes - I will setup a Windows10 in VirtualBox and see if I can get the same
                      result as you have. If so, I guess it’s time to upgrade - Win7 comes to end anyway.

                      strange, i didn’t even manage to crash exit npp using pyscfr on windows 7.

                      either my system is somewhat different … or i didn’t test the right things long enough 😂😂😂
                      just kidding, i think we all tested pyscfr a lot

                      Eko palypseE 1 Reply Last reply Reply Quote 2
                      • Eko palypseE
                        Eko palypse @Meta Chuh
                        last edited by

                        @Meta-Chuh @Peter-Jones

                        Win10 x64
                        Npp7.6.3 x64 7z
                        PythonScript 1.3.0 x64 full.zip

                        and running

                        from Npp import notepad, LANGTYPE
                        LANGUAGES = LANGTYPE.values.values()
                        for language in LANGUAGES:
                            x = notepad.getLanguageDesc(language)
                        

                        results in

                        Faulting application name: notepad++.exe, version: 7.6.3.0, time stamp: 0x5c4dd9e9
                        Faulting module name: ntdll.dll, version: 10.0.17134.376, time stamp: 0x60d78cf9
                        Exception code: 0xc0000374
                        Fault offset: 0x00000000000f4d7b
                        Faulting process ID: 0x1794
                        Faulting application start time: 0x01d4b97dee776c53
                        Faulting application path: C:\tools\Npp\763\x64\notepad++.exe
                        Faulting module path: C:\WINDOWS\SYSTEM32\ntdll.dll
                        Report ID: 18dc0488-4bb7-4063-b564-596ea765af26
                        Faulting package full name: 
                        Faulting package-relative application ID: 
                        

                        BUT what I found out so far is, that this happens only for the very first time you start npp on Win10.
                        5 reboots - 5 crashes after immediate execution.
                        Subsequent starts and script executions do not fail anymore. Did a 100000 loop without a problem.
                        On Win7 this doesn’t matter - every run crashes my npp.

                        ??? Start running out of ideas ??? - Unfortunately I haven’t enough expertise debugging npp in Visual Studio … hmmm …

                        1 Reply Last reply Reply Quote 1
                        • PeterJonesP
                          PeterJones
                          last edited by

                          Thanks again for everyone’s feedback.

                          v0.03-beta has been released. I fixed the tempfile cleanup that @guy038 mentioned (by deleting all temp at the first run of the script – so basically, when you reload NPP – similar to what @Meta-Chuh recommended). I also fixed a couple of things that were starting to annoy me that others hadn’t mentioned yet.

                          Still haven’t been able to debug the crashing thing; I cannot get a reliable crash, so cannot eliminate it. @Eko-palypse : where did you get that detailed crash info that you quoted in your most recent post?

                          Eko palypseE 1 Reply Last reply Reply Quote 2
                          • Eko palypseE
                            Eko palypse @PeterJones
                            last edited by

                            @PeterJones - copied from the windows eventviewer log.

                            1 Reply Last reply Reply Quote 1
                            • PeterJonesP
                              PeterJones
                              last edited by

                              @ekopalypse,

                              I finally found the time to try out your ctypes-based/windows-messaging-based alternative to getLanguageName()/getLanguageDesc(). I haven’t yet seen a crash with my testing of this updated version, and v0.03-beta had started to crash more frequently for me, so I’m hoping v0.04-beta fixed the crash by using your functions.

                              v0.04 Beta Release

                              Newest beta release

                              • Convert from notepad.getLanguageName(notepad.getCurrentLanguage()) to a function __eko_getLexerName() that’s derived from @ekopalypse’s Enhanced UDL Lexer’s get_lexer_name(); similarly for ...getLanguageDesc(...) => __eko_getLexerDesc()

                              • Fix the hex prefix in the filtered filename to never show up as -XXXXXXXX by masking the 32-bit CRC32 with 0xFFFFFFFF, to make sure Python doesn’t incorrectly believe that it’s “negative” when the MSB is 1.

                              You can download just the scripts via pyscFilteredViewer-v0.04-beta.zip

                              EkopalypseE 1 Reply Last reply Reply Quote 2
                              • EkopalypseE
                                Ekopalypse @PeterJones
                                last edited by

                                @PeterJones

                                Since I use the SendMessage method I also had no crash anymore.
                                I tried to pinpoint the cause of the issue but my lack of C++ knowledge isn’t really helpful here ;-)

                                Meta ChuhM 1 Reply Last reply Reply Quote 1
                                • Meta ChuhM
                                  Meta Chuh moderator @Ekopalypse
                                  last edited by Meta Chuh

                                  @PeterJones

                                  wow, 2.2k viewers !!!

                                  it seems that pyscfr isn’t just a cool tool for us internally.
                                  it has apparently caught more interest than the majority of topics, excluding official announcements 👍

                                  @Ekopalypse

                                  you have to reduce your offline times, please 😉

                                  1 Reply Last reply Reply Quote 2
                                  • PeterJonesP
                                    PeterJones
                                    last edited by PeterJones

                                    @Meta-Chuh,

                                    You did a stealth edit and got rid of the “how many downloads at GitHub” question… but I found that timely, because it was just a few hours ago that I went searching how to find that information.

                                    It’s in the GitHub API: https://api.github.com/repos/pryrt/pyscFilteredViewer/releases lists the JSON for the project, and each of the “assets” has a “download_count” attribute. Unfortunately, that appears to just be for the manual script-only zipfile that I upload as an “asset”, because I don’t see download_count for any of their auto-generated tarball/zipball.

                                    At last check, v0.03-beta had 2 downloads, and v0.04-beta had 4. So not exactly the impressive number that the Community “views” count would indicate. I think the 44 posts in this thread, and all of our views where we load/reload/upvote/refresh probably artificially inflate that count. :-)

                                    Meta ChuhM 1 Reply Last reply Reply Quote 2
                                    • EkopalypseE
                                      Ekopalypse
                                      last edited by

                                      you have to reduce your offline times, please

                                      Well there is a fight we can’t win I guess - my boss, she is also called wife, has exactly the opposite opinion :-D

                                      Meta ChuhM 1 Reply Last reply Reply Quote 2
                                      • Meta ChuhM
                                        Meta Chuh moderator @Ekopalypse
                                        last edited by Meta Chuh

                                        @Ekopalypse

                                        Well there is a fight we can’t win I guess - my boss, she is also called wife, has exactly the opposite opinion :-D

                                        easy solution:

                                        • take her to a nice dinner.
                                        • order something very spicy for you.
                                        • complain about a stomach ache because it was too spicy.
                                        • go to the toilet for an extended period of time and use your mobile phone to get here.

                                        side note: repeat this every day, and she’ll get completely used to it. 😉

                                        EkopalypseE 1 Reply Last reply Reply Quote 1
                                        • EkopalypseE
                                          Ekopalypse @Meta Chuh
                                          last edited by Ekopalypse

                                          @Meta-Chuh

                                          the idea is nice despite the fact that I’m already eating very spicy and, sounds strange these days,
                                          I don’t have a mobile. And carrying my laptop with me while having diner with her … well … you can guess
                                          what might happen … a tip … nothing that a man really likes :-D

                                          Meta ChuhM 1 Reply Last reply Reply Quote 1
                                          • Meta ChuhM
                                            Meta Chuh moderator @Ekopalypse
                                            last edited by Meta Chuh

                                            @Ekopalypse

                                            then i have an …

                                            adaption of the hitchhiker’s guide to the notepad++ community for married men:

                                            • take her to a nice dinner to restaurants where you have previously deposited a notebook at every toilet.
                                            • order something very, very spicy for you.
                                            • complain about a stomach ache because it was too spicy.
                                            • go to the toilet for an extended period of time and use your mobile phone to get here.
                                            • take care to limit the amounts of restaurants you visit to only a few, in order not to get broke due to buying a vast amount of notebooks you have to deposit at every toilet.

                                            😂😂😂

                                            EkopalypseE 1 Reply Last reply Reply Quote 1
                                            • First post
                                              Last post
                                            The Community of users of the Notepad++ text editor.
                                            Powered by NodeBB | Contributors