sanskrit-lexicon / csl-pywork

A template for creating pywork repository for each dictionary.
3 stars 1 forks source link

'python' at Cologne: script vs. terminal #21

Closed funderburkjim closed 3 years ago

funderburkjim commented 3 years ago

I've run into a problem with the pywork/redo_xml.sh script at Cologne, for several dictionaries.

Previously, this occurred for dictionaries mw and lan. And today it occurred for dictionary ae.

The problem regards what 'python' means.

When 'python --version' occurs in a terminal session, the result is:

> python --version
Python 3.4.10

But make a script, call it temp.sh:

python --version

And run this script in a terminal

> sh temp.sh
Python 2.6.6

In my .bashrc file at Cologne, there is an alias:

> grep python ~/.bashrc
alias python='/usr/bin/python3'

But apparently this does not carry over into scripts.

Current solution

I change redo_xml.sh to use 'python3' when run at Cologne.
Recall that every time we remake a dictionary, we recreate the scripts by means of a mako template. In this case, the redo_xml.sh mako template

At lines 10 and following, the template now looks like:

%elif cologne_flag:
echo "construct ${dictlo}.xml..."
python3 make_xml.py ../orig/${dictlo}.txt ${dictlo}hw.txt ${dictlo}.xml # > redoxml_log.txt

The logic for pw and pwg is slightly different, and those two dictionaries still use python make_xml.py ....

gasyoun commented 3 years ago

I've run into a problem with the pywork/redo_xml.sh script at Cologne, for several dictionaries.

Looks like a patch to be remembered, @drdhaval2785