Update / solution: answer below from Zack . The problem was that the end of the DOS lines in the script file itself, clenotes.cmd. Since I was so much futzed with various files, I deleted the whole directory and then reloaded the new copy from HERE . I ran the Zack perl script in the file in the same way:
perl -pi.bak -e 's/[ \t\r]+$//' clenotes.cmd
Then I changed the execution of the command a bit so that the final script becomes:
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" " $@ "
So it was - everything else worked. No changes are required for clenotes.py or clenotes.cfg. Thank you very much for sticking to a question which, I think, turned out to be quite simple.
Update: I am shortening some of the code to make it more readable and remove unnecessary information from the message.
I am trying to get the Lotus Notes command line to work on Linux, and I am having a problem with something related to sys.argv [1:] in the python file. The windows script is here:
@echo off @setlocal set CWD=%~dp0 set JYTHON_HOME=%CWD% set LIB_DIR=%JYTHON_HOME%/lib java -cp %LIB_DIR% -jar %LIB_DIR%/jython.jar -Djython.home=%CWD% -python.path=%LIB_DIR%;%CWD%/ext %LIB_DIR%/clenotes/clenotes.py %* @endlocal
I had a hard time with variables, so for Linux it looks something like this:
java -cp ./lib/ -jar ./lib/jython.jar -Djython.home=./ -Dpython.path=./lib:./ext -Djava.library.path=/opt/ibm/lotus/notes/ ./lib/clenotes/clenotes.py $*
I run it from a directory. In any case, it puzzles me that he does not select any parameters that I pass from the command line. clenotes.cmd --help results in
No commands specified. Use --help option for usage.
Here is the section where command line arguments should be parsed:
def main(): Output.log("Entering %sv%s" % (PROGRAM_NAME,VERSION),Output.LOGTYPE_DEBUG) cliOptions2=[] for opt in cliOptions: opt2=opt.replace('--','') opt2=opt2.replace('!','=') cliOptions2.append(opt2) opts=[] args=[] try: opts, args = getopt.getopt(sys.argv[1:], '', cliOptions2)
I am using Python 3.1.3 on Arch Linux 64bit in a 32bit chroot environment. Can I provide anything else?
Just in case, this is necessary ... HERE is the entire clenotes.py file.
In addition, as indicated in the comments, the configuration file (containing the help message and viable parameters / arguments, HERE
Update
After many attempts, the best progress I made was to study what it sets up as options and arguments in the (main) method. The most surprising thing was that when passing the argument, and then looking at the result of the analysis using print sys.argv , in this case the option will have a final \r . For instance:
clenotes.cmd appointments args is ['appointments\r']
On Windows, I did the same, and args was listed as ['appointments'] . Also, manually setting args=['appointments'] and then commenting out the section where getopt.getopt assigns the processed value.
Finally, I found that when using multiple arguments, n-1 of them is interpreted and used, and the nth is ignored. This is kind of a workaround since I can really use a script ... but obviously this is not recommended. If I want to see today's meetings, I can execute clenotes.cmd appointments --today --today and it will work. sys.argv spit out: ['appointments', '--today', '--today\r'] .
So ... what causes the final \r ? I think this is due to the actual script. Remember again:
java -cp ./lib/ -jar ./lib/jython.jar -Djython.home=./ -Dpython.path=./lib:./ext -Djava.library.path=/opt/ibm/lotus/notes/ ./lib/clenotes/clenotes.py $*
So ... a bunch of path material and then the actual python file: clenotes.py $*
I got $* from HERE
Does carriage return collect ??