how to make *.pyo from *.py ?

    • how to make *.pyo from *.py ?

      by what command can be made new *.pyo files?

      would like execute that command manualy after online update to make shorter time of box restart and have longer time picture on the screen
      dm7080sstt; 2x dm8000sstt; dm7020s <- Diseq1x4 <- 3x Diseq1x10 <-
      Dishes:
      1.8m 36E;28E;23E;19E;16E;13E;7E
      1.6m 42E;36E
      1.0m 10/9E;5E;1W;8W
      1.0m 15W;22W;30W
      1.1m 4/5W;12W;18W;24W
      1.1m 53E;60E
      1.0m 75E
      TVs: Philips 46pfl9707s; Philips 42pfl9703h
    • but dreambox's python doesnt have option `-O`

      Quellcode

      1. root@Dream8k_M4:~# python -h
      2. usage: python [option] ... [-c cmd | -m mod | file | -] [arg] ...
      3. Options and arguments (and corresponding environment variables):
      4. -B : don't write .py[co] files on import; also PYTHONDONTWRITEBYTECODE=x
      5. -c cmd : program passed in as string (terminates option list)
      6. -d : debug output from parser; also PYTHONDEBUG=x
      7. -E : ignore PYTHON* environment variables (such as PYTHONPATH)
      8. -h : print this help message and exit (also --help)
      9. -i : inspect interactively after running script; forces a prompt even
      10. if stdin does not appear to be a terminal; also PYTHONINSPECT=x
      11. -m mod : run library module as a script (terminates option list)
      12. -N : do NOT optimize generated bytecode
      13. -Q arg : division options: -Qold (default), -Qwarn, -Qwarnall, -Qnew
      14. -s : don't add user site directory to sys.path; also PYTHONNOUSERSITE
      15. -S : don't imply 'import site' on initialization
      16. -t : issue warnings about inconsistent tab usage (-tt: issue errors)
      17. -u : unbuffered binary stdout and stderr; also PYTHONUNBUFFERED=x
      18. see man page for details on internal buffering relating to '-u'
      19. -v : verbose (trace import statements); also PYTHONVERBOSE=x
      20. can be supplied multiple times to increase verbosity
      21. -V : print the Python version number and exit (also --version)
      22. -W arg : warning control; arg is action:message:category:module:lineno
      23. -x : skip first line of source, allowing use of non-Unix forms of #!cmd
      24. -3 : warn about Python 3.x incompatibilities that 2to3 cannot trivially fix
      25. file : program read from script file
      26. - : program read from stdin (default; interactive mode if a tty)
      27. arg ...: arguments passed to program in sys.argv[1:]
      28. Other environment variables:
      29. PYTHONSTARTUP: file executed on interactive startup (no default)
      30. PYTHONPATH : ':'-separated list of directories prefixed to the
      31. default module search path. The result is sys.path.
      32. PYTHONHOME : alternate <prefix> directory (or <prefix>:<exec_prefix>).
      33. The default module search path uses <prefix>/pythonX.X.
      34. PYTHONCASEOK : ignore case in 'import' statements (Windows).
      35. PYTHONIOENCODING: Encoding[:errors] used for stdin/stdout/stderr.
      36. root@Dream8k_M4:~#
      37. root@Dream8k_M4:~#
      38. root@Dream8k_M4:~# python -O /usr/lib/enigma2/python/*.*
      39. Traceback (most recent call last):
      40. File "/usr/lib/enigma2/python/GlobalActions.py", line 1, in <module>
      41. from Components.ActionMap import ActionMap
      42. File "/usr/lib/enigma2/python/Components/ActionMap.py", line 1, in <module>
      43. from enigma import eActionMap
      44. File "/usr/lib/enigma2/python/enigma.py", line 28, in <module>
      45. _enigma = swig_import_helper()
      46. File "/usr/lib/enigma2/python/enigma.py", line 20, in swig_import_helper
      47. import _enigma
      48. ImportError: No module named _enigma
      49. root@Dream8k_M4:~#
      50. root@Dream8k_M4:~#
      Alles anzeigen


      still searching solution
      dm7080sstt; 2x dm8000sstt; dm7020s <- Diseq1x4 <- 3x Diseq1x10 <-
      Dishes:
      1.8m 36E;28E;23E;19E;16E;13E;7E
      1.6m 42E;36E
      1.0m 10/9E;5E;1W;8W
      1.0m 15W;22W;30W
      1.1m 4/5W;12W;18W;24W
      1.1m 53E;60E
      1.0m 75E
      TVs: Philips 46pfl9707s; Philips 42pfl9703h
    • For example: you have a script onefile.py.
      If you import this file in a other file:

      Quellcode

      1. import onefile

      you get in the same order a file onefile.pyo ;)

      PS.
      or you digit in telnet:

      Quellcode

      1. cd /onelileLocation/
      2. python
      3. import onefile
      44106818

      Dieser Beitrag wurde bereits 2 mal editiert, zuletzt von vali ()

    • thanks Vali

      with commands from telnet pyo were made, but with error messages

      Quellcode

      1. root@Dream8k_M4:~#
      2. root@Dream8k_M4:~# cd /usr/lib/enigma2/python/Components/Converter/
      3. root@Dream8k_M4:/usr/lib/enigma2/python/Components/Converter# python
      4. Python 2.6.4 (r264:75706, Oct 27 2010, 11:34:57)
      5. [GCC 4.4.3] on linux2
      6. Type "help", "copyright", "credits" or "license" for more information.
      7. >>> import EventName.py
      8. Traceback (most recent call last):
      9. File "<stdin>", line 1, in <module>
      10. File "EventName.py", line 1, in <module>
      11. from Components.Converter.Converter import Converter
      12. ImportError: No module named Components.Converter.Converter
      13. >>>
      14. >>> exit
      15. Use exit() or Ctrl-D (i.e. EOF) to exit
      16. >>>
      17. root@Dream8k_M4:/usr/lib/enigma2/python/Components/Converter#
      Alles anzeigen


      but main question is how create from the external script
      there is mine not working version /usr/script/make_pyo_from_py.sh

      Shell-Script

      1. #!/bin/sh
      2. # MartiniB #
      3. #
      4. rm -f $0.py
      5. pyDir=/usr/lib/enigma2/python
      6. for strDir in $pyDir $pyDir/* $pyDir/*/* $pyDir/*/*/* $pyDir/*/*/*/* $pyDir/*/*/*/*/*; do
      7. if [ -d $strDir ]; then
      8. echo $strDir
      9. for strPyFile in $strDir/*.py; do
      10. [ -e $strPyFile ] && [ -s $strPyFile ] && echo "import $strPyFile">>$0.py
      11. done
      12. fi
      13. done
      14. [ -e $0.py ] && date && python $0.py && date
      Alles anzeigen
      dm7080sstt; 2x dm8000sstt; dm7020s <- Diseq1x4 <- 3x Diseq1x10 <-
      Dishes:
      1.8m 36E;28E;23E;19E;16E;13E;7E
      1.6m 42E;36E
      1.0m 10/9E;5E;1W;8W
      1.0m 15W;22W;30W
      1.1m 4/5W;12W;18W;24W
      1.1m 53E;60E
      1.0m 75E
      TVs: Philips 46pfl9707s; Philips 42pfl9703h