sanskrit-lexicon / csl-pywork

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

Error on computer without python2 #28

Closed drdhaval2785 closed 2 years ago

drdhaval2785 commented 2 years ago

I recently configured the local installation in a new computer. It has only python3, and not python2. When I ran the generate_dict.sh script for the SNP dictionary, I got the following error.

remaking snp.sqlite from ../snp.xml with python...
redo.sh: 4: python: not found

I tried doing alias python=python3 in .bashrc file. It did not work either. Same error was there. I think majority of our code is either python3 compatible or in python3. python2 has also reached end of life and is not supported further. Time to change to python3.

It should not be an issue if we explicitly write python3 instead of python in the following code at https://github.com/sanskrit-lexicon/csl-pywork/blob/master/v02/makotemplates/pywork/sqlite/redo.sh .

sqlitedb="${dictlo}.sqlite"
xml="../${dictlo}.xml"
echo "remaking $sqlitedb from $xml with python..."
python sqlite.py $xml $sqlitedb
echo "moving $sqlitedb to web/sqlite/"
mv ${dictlo}.sqlite ../../web/sqlite/

Full log is as below.

$ sh generate_dict.sh snp  ../../snp
updating for websanlexicon for dictionary snp to /var/www/html/cologne/snp
regenerate snp headwords
BEGIN redo_hw.sh
construct xxxhw.txt
0 extra headwords from hwextra/snp_hwextra.txt
6054 lines read from ../orig/snp.txt
453 entries found
453 lines written to snphw.txt
construct xxxhw2.txt
construct xxxhw0.txt
DONE redo_hw.sh
regenerate snp.xml and postxml files
BEGIN redo_xml.sh
construct snp.xml...
All records parsed by ET
xmllint on snp.xml...
snp.sqlite...
remaking snp.sqlite from ../snp.xml with python...
redo.sh: 4: python: not found
moving snp.sqlite to web/sqlite/
mv: cannot stat 'snp.sqlite': No such file or directory
453 records read from ../snp.xml
451 records written to query_dump.txt
END redo_xml.sh
regenerate downloads 
BEGIN: downloads/redo_txt.sh
remove old snptxt.zip
copying files from ../pywork to txt/
create new snptxt.zip
BEGIN: downloads/redo_xml.sh
remove old snpxml.zip
copying files from ../pywork to xml/
create new snpxml.zip
BEGIN: downloads/redo_web1.sh
remove old snpweb1.zip
drdhaval2785 commented 2 years ago

After making change from python to python3, the regeneration did not give any error.

$ sh generate_dict.sh snp  ../../snp
updating for websanlexicon for dictionary snp to /var/www/html/cologne/snp
regenerate snp headwords
BEGIN redo_hw.sh
construct xxxhw.txt
0 extra headwords from hwextra/snp_hwextra.txt
6054 lines read from ../orig/snp.txt
453 entries found
453 lines written to snphw.txt
construct xxxhw2.txt
construct xxxhw0.txt
DONE redo_hw.sh
regenerate snp.xml and postxml files
BEGIN redo_xml.sh
construct snp.xml...
All records parsed by ET
xmllint on snp.xml...
snp.sqlite...
remaking snp.sqlite from ../snp.xml with python...
sqlite.py: dictionary code= snp
create_index takes 0.10 seconds
458 lines read from ../snp.xml
453 rows written to snp.sqlite
0.37 seconds for batch size 10000
moving snp.sqlite to web/sqlite/
453 records read from ../snp.xml
451 records written to query_dump.txt
END redo_xml.sh
regenerate downloads 
BEGIN: downloads/redo_txt.sh
remove old snptxt.zip
copying files from ../pywork to txt/
create new snptxt.zip
BEGIN: downloads/redo_xml.sh
remove old snpxml.zip
copying files from ../pywork to xml/
create new snpxml.zip
BEGIN: downloads/redo_web1.sh
remove old snpweb1.zip
drdhaval2785 commented 2 years ago

Thus the change is accordingly made.