开发者

Migrating jython wsadmin scripts from Websphere 6.1 to 7, and passing arguments to a child script

开发者 https://www.devze.com 2023-03-01 16:42 出处:网络
I have a few wsadmin-jython questions: 开发者_高级运维 If I write a bunch of jython scripts for webSphere v6.1, will they all still work on websphere v7? (backwards compatibility)

I have a few wsadmin-jython questions:

开发者_高级运维
  1. If I write a bunch of jython scripts for webSphere v6.1, will they all still work on websphere v7? (backwards compatibility)

  2. If I wish to call another jython script - can I pass sys.argv arguments?

Thank you very much.


  1. Jython currently only supports Python 2.x versions, which are compatible, so yes, scripts for WS 6.x should also work in 7.x, at least from a language point of view (i.e. I can't guarantee for WebSphere-specific objects and calls).

  2. I'm not sure I understand what you mean, can you elaborate on that ? You certainly can import scripts between each other, i.e. if you have script1.py and script2.py, and you define a function MyFunc in script2 only, in script1 you can certainly do

    from script2 import MyFunc
    

    and then pass to that function any argument you wish.


Q: If I wish to call another jython script - can I pass sys.argv arguments?

A1: Yes you can if you just want the functions from it. Make sure the script is in the python path or in the same directory as wsadmin. Then in the script that is calling the other import the other script.

Say your script is called "script.py"

import script
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号