• CLE on Linux

    By John W Henderson 1 decade ago

    I'm still having issues on this. For all the view... I've gotten no responses on the other forum:

    - Here: http://www.ibm.com/developerworks/forums/thread.jspa?threadID=251542&tstart=0

    - Or here: http://www.ibm.com/developerworks/forums/thread.jspa?threadID=322816&tstart=0

    - Or here: http://www.ibm.com/developerworks/forums/thread.jspa?threadID=350302

    I've futzed with the script once more and ended up with this:

    ----   

    CWD=`dirname $0`
    
    JYTHON_HOME="$CWD"
    
    LIB_DIR="/home/jwhendy/Downloads/CLENotes-4.1.1/lib"
    
    NOTES_HOME="/opt/ibm/lotus/notes/"
    
    #PATH="$PATH:$NOTES_HOME"
    
    #export PATH
    
    java -cp "$LIB_DIR" -jar "/home/jwhendy/Downloads/CLENotes-4.1.1/lib/jython.jar" -Djython.home="/home/jwhendy/Downloads/CLENotes-4.1.1/" -Dpython.path="/home/jwhendy/Downloads/CLENotes-4.1.1/lib:/home/jwhendy/Downloads/CLENotes-4.1.1/ext" -Djava.library.path="/opt/ibm/lotus/notes/" "/home/jwhendy/Downloads/CLENotes-4.1.1/lib/clenotes/clenotes.py --help"
    
    #$*
    
    
        CWD=`dirname $0`
    
        JYTHON_HOME="$CWD"
    
        LIB_DIR="/home/jwhendy/Downloads/CLENotes-4.1.1/lib"
    
        NOTES_HOME="/opt/ibm/lotus/notes/"
    
        #PATH="$PATH:$NOTES_HOME"
    
        #export PATH
    
        java -cp "$LIB_DIR" -jar "/home/jwhendy/Downloads/CLENotes-4.1.1/lib/jython.jar" -Djython.home="/home/jwhendy/Downloads/CLENotes-4.1.1/" -Dpython.path="/home/jwhendy/Downloads/CLENotes-4.1.1/lib:/home/jwhendy/Downloads/CLENotes-4.1.1/ext" -Djava.library.path="/opt/ibm/lotus/notes/" "/home/jwhendy/Downloads/CLENotes-4.1.1/lib/clenotes/clenotes.py --help"
    
        #$*
    
    
            CWD=`dirname $0`
    
            JYTHON_HOME="$CWD"
    
            LIB_DIR="/home/jwhendy/Downloads/CLENotes-4.1.1/lib"
    
            NOTES_HOME="/opt/ibm/lotus/notes/"
    
            #PATH="$PATH:$NOTES_HOME"
    
            #export PATH
    
            java -cp "$LIB_DIR" -jar "/home/jwhendy/Downloads/CLENotes-4.1.1/lib/jython.jar" -Djython.home="/home/jwhendy/Downloads/CLENotes-4.1.1/" -Dpython.path="/home/jwhendy/Downloads/CLENotes-4.1.1/lib:/home/jwhendy/Downloads/CLENotes-4.1.1/ext" -Djava.library.path="/opt/ibm/lotus/notes/" "/home/jwhendy/Downloads/CLENotes-4.1.1/lib/clenotes/clenotes.py --help"
    
            #$*
    
    
                CWD=`dirname $0`
    
                JYTHON_HOME="$CWD"
    
                LIB_DIR="/home/jwhendy/Downloads/CLENotes-4.1.1/lib"
    
                NOTES_HOME="/opt/ibm/lotus/notes/"
    
                #PATH="$PATH:$NOTES_HOME"
    
                #export PATH
    
                java -cp "$LIB_DIR" -jar "/home/jwhendy/Downloads/CLENotes-4.1.1/lib/jython.jar" -Djython.home="/home/jwhendy/Downloads/CLENotes-4.1.1/" -Dpython.path="/home/jwhendy/Downloads/CLENotes-4.1.1/lib:/home/jwhendy/Downloads/CLENotes-4.1.1/ext" -Djava.library.path="/opt/ibm/lotus/notes/" "/home/jwhendy/Downloads/CLENotes-4.1.1/lib/clenotes/clenotes.py --help"
    
                #$*
    
    
                    CWD=`dirname $0`</div>
    
                    JYTHON_HOME=&quot;$CWD&quot;</div>
    
                    LIB_DIR=&quot;/home/jwhendy/Downloads/CLENotes-4.1.1/lib&quot;</div>
    
                    NOTES_HOME=&quot;/opt/ibm/lotus/notes/&quot;</div>
    
                    #PATH=&quot;$PATH:$NOTES_HOME&quot;</div>
    
                    #export PATH</div>
    
                    java -cp &quot;$LIB_DIR&quot; -jar &quot;/home/jwhendy/Downloads/CLENotes-4.1.1/lib/jython.jar&quot; -Djython.home=&quot;/home/jwhendy/Downloads/CLENotes-4.1.1/&quot; -Dpython.path=&quot;/home/jwhendy/Downloads/CLENotes-4.1.1/lib:/home/jwhendy/Downloads/CLENotes-4.1.1/ext&quot; -Djava.library.path=&quot;/opt/ibm/lotus/notes/&quot; &quot;/home/jwhendy/Downloads/CLENotes-4.1.1/lib/clenotes/clenotes.py&quot; $*</div>
                <p>
                    I couldn&#39;t get the script to work properly with variables for one. For example, if I inserted an &quot;echo $LIB_DIR&quot; after the LIB_DIR directory is set, I simply get &quot;/lib&quot; as the response. If I do the same for JYTHON_HOME, I get &quot;.&quot;. So it&#39;s getting them both right, but not concatenating them.</p>
                <p>
                    Anyway, at present, I can at least run the script, but two options occur:</p>
                <p>
                    - I run ./clenotes.cmd and get:<br/>
                    ----<br/>
                    Command Line Client for Lotus Notes v4.1.1<br/>
                    Copyright (c) 2002, 2010 by IBM Corporation.<br/>
                    Licensed under the Apache License v2.0.<br/>
                    <br/>
                    &quot; not recognized.<br/>
                    ----</p>
    
                    &nbsp;</div>
            </div>
        </div>
    </div>
    

    - I run "./clenotes.cmd --help" and get:
    ----
    Command Line Client for Lotus Notes v4.1.1
    Copyright (c) 2002, 2010 by IBM Corporation.
    Licensed under the Apache License v2.0.

    No commands specified. Use --help option for usage.
    ----

    So... it's not seeing whatever I put as an option. How can I fix this? Also, is there something wrong with the Linux version of the script from the forum that it would not be concatenating properly and thus require me to manually insert all of the proper directories rather than being able to do it via variables?

     

    Thanks,

    John

     
                </div>
            </div>
        </div>
    </div>
    

     



  • CLE on Linux

    By John W Henderson 1 decade ago

     

        <p>
            I hunted around since what seems to be happening is that command line arguments are not being recognized. I don&#39;t know python, but see if this helps:</p>
        <p>
            ----</p>
    
            def main(): &nbsp; &nbsp;
    
            &nbsp;&nbsp;
    
            &nbsp;&nbsp;Output.log(&quot;Entering %s v%s&quot; % (PROGRAM_NAME,VERSION),Output.LOGTYPE_DEBUG)
    
            &nbsp;&nbsp;cliOptions2=[]
    
            &nbsp;&nbsp;for opt in cliOptions:
    
            &nbsp;&nbsp; &nbsp;opt2=opt.replace(&#39;--&#39;,&#39;&#39;)
    
            &nbsp;&nbsp; &nbsp;opt2=opt2.replace(&#39;!&#39;,&#39;=&#39;)
    
            &nbsp;&nbsp; &nbsp;cliOptions2.append(opt2)
    
            &nbsp;&nbsp;opts=[]
    
            &nbsp;&nbsp;args=[]
    
            &nbsp;&nbsp;try:
    
            &nbsp;&nbsp; &nbsp;opts, args = getopt.getopt(sys.argv[1:], &#39;&#39;, cliOptions2)
    
    
                def main(): &nbsp; &nbsp;</div>
    
                &nbsp;&nbsp;</div>
    
                &nbsp;&nbsp;Output.log(&quot;Entering %s v%s&quot; % (PROGRAM_NAME,VERSION),Output.LOGTYPE_DEBUG)</div>
    
                &nbsp;&nbsp;cliOptions2=[]</div>
    
                &nbsp;&nbsp;for opt in cliOptions:</div>
    
                &nbsp;&nbsp; &nbsp;opt2=opt.replace(&#39;--&#39;,&#39;&#39;)</div>
    
                &nbsp;&nbsp; &nbsp;opt2=opt2.replace(&#39;!&#39;,&#39;=&#39;)</div>
    
                &nbsp;&nbsp; &nbsp;cliOptions2.append(opt2)</div>
    
                &nbsp;&nbsp;opts=[]</div>
    
                &nbsp;&nbsp;args=[]</div>
    
                &nbsp;&nbsp;try:</div>
    
                &nbsp;&nbsp; &nbsp;opts, args = getopt.getopt(sys.argv[1:], &#39;&#39;, cliOptions2)<br/>
                -----</div>
            <p>
                If I change &quot;sys.argv[1:]&quot; to &quot;sys.argv[1]&quot; I can get --help recognized as an option but other things aren&#39;t taken in. What might be doing this?</p>
        </div>
    </div>
    
        &nbsp;</div>
    

  • CLE on Linux

    By John W Henderson 1 decade ago

     

        <p>
            Sorry -- in the above code, the &quot;sys.argv1&quot; should have square brackets surrounding the 1. I can&#39;t seem to get them to show up properly. Inspect the main method in the .py file and it will be clear. My point was that in changing the &quot;1:&quot; inside the square brackets of sys.argv to just a 1, I was able to get some progress. I think my issue has something to do with this.</p>
        <p>
            Thanks.</p>
    </div>
    

  • Linux params

    By Sami Salkosuo 1 decade ago

    Linux is not familiar for me and I can't test the program on Linux. But it seems that problem is related to command line parameters. I found this site:

    http://shelldorado.com/goodcoding/cmdargs.html

    Site is about using command line arguments. Apparently $@ is used when reading multiple arguments on Linux but I unfortunately I can't test it.

    • Thanks,though not working

      By John W Henderson 1 decade ago

      Hi Sami,

      Thanks for the reply. Changing to $@ did not affect things. Some at stack exchange are looking at it as well HERE if you're interested in following the resolution (if there is one!).

      What puzzles me is that the end argument ($@ or $*) doesn't seem to explain why if I change sys.argv from 1: to 1... it will take at least the --help option. But it still won't take mail or any other option. Or is it not really seeing "--help" but printing it because it doesn't think I got the usage right? For example, if I do ./clenotes.cmd --version, I get:

      Command "-" not recognized.



      Command "-" not recognized.



      Command "v" not recognized.



      Command "e" not recognized.



      Command "r" not recognized.



      Command "s" not recognized.



      Command "i" not recognized.



      Command "o" not recognized.



      Command "n" not recognized.
      " not recognized.

      Looks like it's tokenizing by letter or something?

      Still perplexed!

  • SOLVED!

    By John W Henderson 1 decade ago

    See HERE for the solution. The issue was DOS line endings on a Unix system. A simple perl script on clenotes.cmd fixed the issue and the final script was like so:

    ---



    CWD=`dirname $0`
    JYTHON_HOME="$CWD"
    LIB_DIR="$JYTHON_HOME/lib"
    NOTES_HOME="/opt/ibm/lotus/notes/"
    export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$NOTES_HOME
    java -cp "$LIB_DIR" -jar "$LIB_DIR/jython.jar" -Djython.home="$CWD/" -Dpython.path="$LIB_DIR:$CWD/ext" -Djava.library.path="$NOTES_HOME" "$LIB_DIR/clenotes/cletes/clenotes.py" "$@"
    

    ---

    • Great!

      By Sami Salkosuo 1 decade ago

      Great!

      Dos line endings.... Yes, of course. It's obvious now that I think of it :-)

      Thanks!

      Regards,

      Sami

      • Thank StackOvervlow!

        By John W Henderson 1 decade ago

        Hi Sami,

        Yes -- very happy to have this resolved. It was entirely due to the folks at StackOverflow. They really stuck with it! In the end... what a surprisingly simple fix. I'm just glad to have this working. It is just awesome that something this simple exists for the beast that is Lotus Notes. How refreshing for commandline junkies who want to pipe the output into something neat and useful. Thanks again!

        John