Python Script v1.0.1

2014-03-23
2014-04-21
  • Almost exactly 3 years too late, Python Script v1.0.1 is out. This is essentially a beta-release, but should actually be significantly more stable than v0.9.2

    As previously mentioned, the main updates are a rewrite of the search and replace functionality - everything should now use editor.replace() and editor.rereplace(), and a reworking of the callback functionality. Both changes should make everything much more stable. Lots of bug fixes and improvements have gone into this release - for a full list, take a look at http://www.brotherstone.co.uk/npp/ps/changelog.shtml

    Most of the functionality is now covered by unit tests, which should improve the stability going forward. If you spot any issues, please report them either here on this thread, or ideally on the github issues page - https://github.com/davegb3/PythonScript/issues?state=open

    Cheers,
    Dave.

     
  • Dave W.
    Dave W.
    2014-03-23

    Excellent! ;-)
    Any idea when it'll hit the PluginManager Update channel?
    (It's not showing yet...)

    Thanks

     
  • Probably not for a little while yet. I'd really like some feedback first. Using the MSI makes it more or less just as easy to install - just download straight from the download link and install - point the installation directory to your Notepad++ directory and it should just work. The MSI also takes care of making sure your Python libraries get updated.

    I'm hoping, for example, to have a python wrapper for pyreplace and pymlreplace before it goes on PM. It will probably be quite slow, although probably still faster than the last version, but at least people can import it if they don't want to update their scripts to replace/rereplace.

    Cheers,
    Dave.

     
  • Dave W.
    Dave W.
    2014-03-23

    Ah. Gotcha. OK - we'll give it a spin. Thanks!

     
  • Ron Jensen
    Ron Jensen
    2014-03-25

    Thanks Dave,

    I ran through a 17k line, 950kbyte file in seconds instead of minutes. I'll be beating it up more the rest of this week.

    I tried figuring the syntax for editor.search and editor.research and failed...

    Ron

     
  • Good stuff :)

    editor.search and editor.research are the same format as editor.replace and editor.rereplace, just that the "replace" argument must be a function, and that function gets called with the re.MatchObject (the same as if you pass a function to editor.rereplace).

    def foundSomething(m):
        console.write('Found "{0}" at {1}\n'.format(m.group(0), str(m.span(0))))
    
    editor.research('[a-z]+[0-9]', foundSomething)
    
     
  • Kyrus86
    Kyrus86
    2014-04-14

    Hello Dave,

    First of all: Thank you for this excellent Plugin. :)

    I think in Version 1.0.2 is something wrong with the notepad.runPluginCommand()-Command.
    Every time I try to use ist, Notepad++ crashes.

    I also tried it with the Portable Notepad++ Version in case some other Plugins are interfering, but the Problem stays.

    I used the Command notepad.runPluginCommand("Converter","ASCII -> HEX") for testing.

     
    • Hi, thanks for reporting this. I'm actually away at the moment, but I'll
      look into this when I get back after easter. Does any plugin command crash
      it, or just the converter? If you run the script up to the point where you
      run the plugin command, and then click the plugin option manually, does
      that work?

      Thanks
      Dave

       
      Attachments
  • Hi, thanks for reporting this. I'm actually away at the moment, but I'll look into this when I get back after easter. Does any plugin command crash it, or just the converter? If you run the script up to the point where you run the plugin command, and then click the plugin option manually, does that work?

    Thanks
    Dave

     
  • Ron Jensen
    Ron Jensen
    2014-04-16

    I see the same thing (a crash) when lauching the command notepad.runPluginCommand("Converter","ASCII -> HEX") and notepad.runPluginCommand("MIME Tools", "Base64 Encode") from the Python Console. Both work from the Plugins menu

    Ron

     
    Last edit: Ron Jensen 2014-04-16
  • Ron Jensen
    Ron Jensen
    2014-04-21

    A while back I posted a Mandelbrot generator on the notepad++ discussion forum I noticed it no longer runs under 1.0.2. It seems the abs() call around line 30 never returns. Replacing the PythonScript.dll with the one from 0.9.2 fixes the problem.

    Ron

     
  • Wow, good catch! I was just creating the release for the runPluginCommand bug.

    Turns out this was a call to hypot() that was defined to _hypot, which would be correct, but there's a C function in math.h called hypot() that just calls _hypot(), such that if math.h is included after pyconfig.h, this hypot is just a recursive call to itself.

    I've removed the define, and now I get a pretty mandelbrot :)

    I'll release 1.0.4 momentarily.

    Thanks again for reporting.

    Dave.

     
  • Ron Jensen
    Ron Jensen
    2014-04-21

    Funny, hypot() was the function I was trying to use the other day when I first noticed a potential problem. I waited to confirm it at work before posting, though.

    Thanks for the quick fixes.

    Ron