Thursday, October 24, 2013

Writing and Testing Python/Jython Scripts with Notepad++

Hi all,
I have something interesting for Notepad++ lovers.
You can write scripts and run them with Python Script plugin. I find this very useful for testing custom functions, string functions, etc.

You can install it from Plugin Manager in Notepad++:
Once it's installed and Notepad++ is restarted we will see the new plugin in the Plugins menu:

Creating a new Python script
You can create a new python script from menu Python Script > New Script.
 Then write your code and run it from menu Python Script > Run Previous Script
Using the Python Console
Besides writing a script with indentation, syntax check, colors, etc. you can also run the python console:
Running Jython Scripts
As you see above we were using Phyton... do you want to use Jython as FDMEE does?
You can create a Run Command in NotePad++ as follows:
java -jar E:\Oracle\Middleware\odi\oracledi.sdk\lib\jython.jar -i "$(FULL_CURRENT_PATH)" 
Save it and configure accelerator if you wish: 
You can then write scripts in Notepad++, set language to Python (Language > P > Python) save them as .py scripts, and run the command saved above. 
That will execute your script and show the result in the JVM:
Note that you have to indent yourself when needed. Would it be better that when I press Enter code is automatically indented if needed?  for example when using if statements :-)
Absolutely. You can install Python Indent plugin to get this working:
 After enabling it you will get code indented.

Running FDMEE Jython Scripts
If you take a look to post Using PyDev for Jython Scripts you will remember about initialization code needed in order to get the context information from a FDMEE Load ID.
If you want to run Jython scripts in Notepad++ with fdmContext and fdmAPI objects you will have to include the initialization code in the script.
After some testing I noticed that same code working in Eclipse was not working in Notepad++. It does not find a suitable driver for Oracle connection :-\ 
After some googling and troubleshooting I got it working by switching to using the Oracle Call Interface (OCI) method described in this article

I still prefer PyDev/Eclipse but here you have more options :-)

Enjoy!

71 comments:

  1. Replies
    1. Wonderful work.. That is the kind of information that should be
      shared across the web.thanks for sharing I must say you have done a awesome job with this.the blog loads extremely fast for me on Chrome.
      Outstanding Blog and outstandig share of Adobe Photoshop cs3 keygen activation

      Delete
    2. I suggest you to use Spyhunter 4 Crack. It is the best Antivirus for windows http://crackskey.com/spyhunter-4-crack-serial-number-full-version-download/ CherSssS!!!!

      Delete
  2. Dear Guru,

    Much appreciated if you could advise why my import script succeded being executed in Eclipse but faied in FDMEE
    def GetAging(strfield,strrec):
    from datetime import date
    # Get POV period and convert
    POVDate = fdmContext['PERIODKEY']
    seglist = POVDate.split('/')
    currPeriod = date(int(seglist[2]),int(seglist[0]),int(seglist[1]))
    # Get date from input row and convert
    seglist = strrec.split(',')
    mydate = seglist[1]
    seglist = mydate.split('/')
    chkDate = date(int(seglist[2]),int(seglist[0]),int(seglist[1]))
    # Compare dates
    ageDays = currPeriod - chkDate
    # Determine aging
    invAge = ''
    if ageDays.days > 90:
    invAge = '3MTHMORE'
    else:
    if ageDays.days >60:
    invAge = '3MTH'
    else:
    if ageDays.days >30:
    invAge = '2MTH'
    else:
    invAge = '1MTH'
    return invAge

    it fails while the ErpIntegrator log says -
    [2014-07-23T19:37:14.202-05:00] [EPMServer0] [ERROR] [105039] [oracle.apps.erpi.model] [tid: 11] [userId: ] [ecid: 00iNNjWiExOEkJ8zngvH8300004^00094H,0:1:4] [APP: AIF#11.1.2.0] [URI: /workspace/logon] [SRC_CLASS: com.hyperion.aif.file.common.util.FileUtils] [SRC_METHOD: logError] EPMERPI - 105042:EPMERPI - Error evaluating the script.[[
    null Traceback (innermost last):
    File "", line 1, in ?
    File "D:\demos\FDMEE/data/scripts/import/GetAging.py", line 24, in GetAging
    ImportError: no module named datetime

    Thanks,
    Yibing

    ReplyDelete
    Replies
    1. Hi,
      I don't know if it's just coincidence but I posted yesterday about this issue.
      http://akafdmee.blogspot.com/2014/08/import-scripts-do-not-use-same-jython.html
      As you can see in the following link datetime was introduces in 2.3 so it cannot be be imported from import script.
      https://docs.python.org/2/library/datetime.html

      Regards

      Delete
    2. Thank you Guru. I have reported this to Oracle but they do not see this as a bug. As a workaround, I use 'sys.path.append' to include a path of Jython 2.5.1 and make the script work.

      Thanks and Regards,
      Yibing

      Delete
    3. Yes, that's the workaround. Having different versions of Jython become an issue when you want to share global variables between scripts...

      Delete
  3. wao amazing post Notepad++ 6.5 Full Version really nice work on site ...welldone.. i bookmark yousite and all data

    ReplyDelete
  4. really nice data and info , so i am feeling good to see , after reading your article , feeling much happay and solve provlem that i have :) Adobe Photoshop Cs6 Serial Number i appreciate you

    ReplyDelete
  5. Wе’re a grouÑ€ of volunteers and starting a new scheme in our commÕ½nity.
    Your site provided us with aluable info to work on. You’ve done a formidable job and ouur whole
    coommunity will be thankful to you.
    crackwindows.com

    ReplyDelete
  6. WOW...I was just searching for those info and look where i landed...I am lucky that i found this site...you have saved a lot of time of me..Thanks and keep it up :D
    MS Office 2007 Full

    ReplyDelete

  7. I enjoy what you guys are up too. This sort of clever work and coverage!
    Keep up the excellent works crackeygen

    ReplyDelete
  8. Your website offered us with helpful info to work on. You’ve done an impressive job
    and our entire community will probably be grateful to you and a lot of thanks for you and particularly thanks for keep my post ow your site.
    crackWindows

    ReplyDelete
  9. I have no words for you to appreciate you. your work is nice and posts are so nice... all is well.

    ReplyDelete
  10. Woah! I’m really loving the template/theme of this website.
    It’s simple, yet effective. A lot of times it’s challenging tto get that “perfect balance” bbetween user friendliness and visual appeal.
    Daemon Tools Pro Advanced 5.5 Crack

    ReplyDelete
  11. Yes, that's the workaround.XENFORO FORUM 1.4.2 Nulled Having different versions of Jython become an issue when you want to share global variables between scripts...

    ReplyDelete
  12. excellent I really like reading the particular articles right here.
    Evaer Video Recorder For Skype 1.6.2.75 Keygen

    ReplyDelete
  13. wow. this is great website. Your tips is very useful. I will use this site for income money. Thanks for shearing this site


    PowerISO v6.2 With Keygen

    ReplyDelete
  14. I’m extremely pleased to discover this great site.
    I want to to thank you for ones time for this particularly wonderful read!!
    I definitely enjoyed every little bit of it and i also have you saved
    as a favorite to check out new stuff on your web site.
    SpyHunter 4 Crack

    ReplyDelete
  15. O this is great software i really need this software… thanks admin for sharing
    keep it up HASHMI

    ReplyDelete
  16. Thanks dear admin nice written and well arranged article. I’m thinking about setting up my own but I’m not sure where to start..
    idm software

    ReplyDelete
  17. So nice admin.. Great post. Definitely add to the portfolio. I don't know if I could do that.This article was fascinating..thanks thanks again thanks..
    speed up my pc

    ReplyDelete
  18. So nice and thanks for this Great sharing i like this post..and your site is amazing all of this.. so great

    driver toolkit 8.4 serial key

    ReplyDelete
  19. well keep it up so glad at you.. Thank you for this...
    teamviewer 10 activation code

    ReplyDelete
  20. Wonderful work.. That is the kind of information shared is awesome hashmi. . . . . . .

    ReplyDelete
  21. all is well thank you admin glad to see all of this.. well done keep it up....
    ulead video studio 11.5
    remote pc control

    ReplyDelete
  22. Very rapidly this site will be famous amid alll bpog people,
    due to it’s good posts. http://www.crackeygen.com/razer-surround-pro-crack-activation-key-download/

    ReplyDelete
  23. Pretty! This was a really wonderful post. Many thanks for providing
    this info.
    Cursor Fx Plus 2.11 Full crack

    ReplyDelete
  24. Ninja Blaster 2015 Crack

    Your are doing Good Job Really cool work you are doing Fabulous work.

    ReplyDelete
  25. If you want latest version of spyhunter for android you just have to click on

    https://cracksnew.com/spyhunter-4-crack.html
    to get it.

    ReplyDelete
  26. A very nice and good post this. I really like it very much. Keep this quality of your work on articles going on and please do not let the quality of your articles fall to bad. Cheers
    Sony Vegas Pro 13 serial number
    Office 2013 Product Key

    ReplyDelete
  27. Its an amazing and well designed post....

    ReplyDelete
  28. Hello,
    My name is Qamar Shahzad, your website is cool, and has a good stuff on your website. I like it
    Microsoft Office 2013

    ReplyDelete
  29. Hello,
    My name is Qamar Shahzad, your website is cool, and has a good stuff on your website. I like it
    Typing Master Pro Latest version Tutor Download

    ReplyDelete
  30. you are doing a great job your blog is fantastic keep it up admin nice work
    PhpStorm 9 Key

    ReplyDelete
    Replies
    1. i agree with you Qureshi
      http://fashionperday.com/stylish-handbags-designs-for-girls/

      Delete
  31. All the stuff is cool. i appreciate you for giving an easy way to the world thanks admin.YAC Antivirus 2015 Crack


    ReplyDelete
  32. Hi to every , since I am really keen of reading this website’s post to be updated daily.
    It contains nice information..Corel Draw X3 keygen Crack

    ReplyDelete
  33. hi there, first of all i appreciate to the admin he give us a great platform in which we can solve problems..Secondly i have all the collection of windows activators,loaders,Softwares of all kinds,PC softwares Crack
    YAC Antivirus2015

    ReplyDelete
  34. This comment has been removed by the author.

    ReplyDelete
  35. hi there, first of all i appreciate to the admin he give us a great platform in which we can solve problems..Secondly i have all the collection of windows activators,loaders,Softwares of all kinds,Corel Draw X3 keygen Crack,Dll Files Fixer 3.2.90 Premium Crack.

    ReplyDelete
  36. i appreciate you for giving an easy way to the world thanks admin

    http://fashionperday.com/

    ReplyDelete
  37. It’s actually a great and helpful piece of info.
    I’m happy that you shared this helpful information with us.
    Please stay us informed like this. Thanks for sharing.
    Fullversiondownloadz
    Macx Video Converter [v5.0.8] Key

    Uniblue Driver Scanner v6.1.0 Crack

    iCountTimer Pro

    ReplyDelete
  38. Quality posts is the key to invite the users to pay a quick visit the web page,
    that’s what this website is providing.

    ReviverSoft PC Reviver
    Adobe Photoshop CS5

    ReplyDelete
  39. This comment has been removed by the author.

    ReplyDelete
  40. All the stuff is well managed and i appreciate for you work.
    Red Alert 2 Free Download

    ReplyDelete
  41. Thanks Admin For Giving Us A New & Unique Idea For Notpad I really Like It Very Much I really Implement As Soon As Thanks Again From: Video Maker

    ReplyDelete
  42. What a thoroughly enlightening piece. I'm sure to try the tips you've outlined here in the near future. Hope to read more of your useful pointers as well. Corel Draw X8 Serial Number

    ReplyDelete
  43. I would like to say thanks for this wonderful information
    really nice article that you have to write , i really appriciate
    YTD Video Downloader

    ReplyDelete
  44. It’s genuinely very complicated in this active life to listen news on TV,
    so I simply use world wide web for that purpose, and get
    the most up-to-date information.

    Hotspot Shield Crack

    ReplyDelete
  45. Writing is something that we should know about. Windows 7 loader

    ReplyDelete
  46. Got what i am searching for. Really helpful.

    ReplyDelete
  47. this site very helpful for reader and get more information here, and i found this blog good information and sharing about all.

    OFFICE 2013 ACTIVATOR

    ReplyDelete
  48. Nice Work dude another blog is also sharing good information like you..
    ESET KEY

    ReplyDelete

Thanks for feedback!