Skip to content
KM-200 edited this page Aug 29, 2018 · 6 revisions

so the .py files are run via click-to-launch in dolphin filemanager:


#!/bin/bash
rm                         /tmp/_xx
echo -e "#!/usr/bin/python3 \n# -*- coding: utf-8 -*- \n" > ./shebangPYheader
for FILE in $(find ./examples/ -maxdepth 5 -type f -name "*.py"); do
  chmod +x $FILE
  cat ./shebangPYheader >> /tmp/_xx 
  cat $FILE             >> /tmp/_xx 
  cat                      /tmp/_xx  > $FILE
  rm                       /tmp/_xx
done


  msg 'prepend py2 header in alternate fashion'
  find . -type f -print0 | xargs -0 sed -i 's#/usr/bin/python$#/usr/bin/python2#g'
  find . -type f -print0 | xargs -0 sed -i 's#/usr/bin/env python$#/usr/bin/env python2#g'

}


now all the example files can be clicked and run nicely !

Clone this wiki locally