You can easily convert float color list (i.e. used in Kivy [1]) to Web RGB in Python [2] with oneliner:
c = [0.5019607843137255, 0.796078431372549, 0.7686274509803922, 1.0] rgb = '#%02X%02X%02X%02X' % tuple(int(255*i) for i in c) '#80CBC4FF'
You can easily convert float color list (i.e. used in Kivy [1]) to Web RGB in Python [2] with oneliner:
c = [0.5019607843137255, 0.796078431372549, 0.7686274509803922, 1.0] rgb = '#%02X%02X%02X%02X' % tuple(int(255*i) for i in c) '#80CBC4FF'
If you encounter a problem with running Python [python] scripts on a “bare” Blender Player [blender], make sure that both PYTHONHOME
and PYTHONPATH
are set correctly to match your needs. You can also use native Blender python with a simple shell script:
#!/bin/sh export PYTHONHOME="/path/to/blender/python/" export PYTHONPATH=$PYTHONHOME"/bin" /path/to/your/blenderplayer $@
[python] https://www.python.org/
[blender] https://www.blender.org/
Sometimes you need to quickly create a hexeditor like dump of a binary file. HEXDUMP is your friend. It may be a standard Unix application or Python module.
Unix hexdump use example:
hexdump -Cv file.bin 00000000 12 01 00 02 ef 02 01 40 28 0d 04 02 00 10 01 02 |.......@(.......| 00000010 03 01 12 01 00 02 ef 02 01 40 28 0d 04 02 00 10 |.........@(.....| 00000020 01 02 03 01 09 02 82 00 04 01 00 80 fa 09 02 82 |................| 00000030 00 04 01 00 80 fa 09 04 00 00 02 08 06 50 07 07 |.............P..| 00000040 05 82 02 40 00 00 07 05 02 02 40 00 00 09 04 03 |...@......@.....| 00000050 00 02 03 00 00 06 09 21 00 01 00 01 22 21 00 07 |.......!...."!..| 00000060 05 81 03 40 00 01 07 05 01 03 40 00 01 08 0b 01 |...@......@.....| 00000070 02 02 02 01 04 09 04 01 00 01 02 02 01 04 05 24 |...............$| 00000080 00 10 01 05 24 01 03 02 04 24 02 06 05 24 06 01 |....$....$...$..| 00000090 02 07 05 83 03 10 00 20 09 04 02 00 02 0a 00 00 |....... ........| (...)
Python hexdump use example:
python -m pip install hexdump python -m hexdump file.bin 00000000: 12 01 00 02 EF 02 01 40 28 0D 04 02 00 10 01 02 .......@(....... 00000010: 03 01 12 01 00 02 EF 02 01 40 28 0D 04 02 00 10 .........@(..... 00000020: 01 02 03 01 09 02 82 00 04 01 00 80 FA 09 02 82 ................ 00000030: 00 04 01 00 80 FA 09 04 00 00 02 08 06 50 07 07 .............P.. 00000040: 05 82 02 40 00 00 07 05 02 02 40 00 00 09 04 03 ...@......@..... 00000050: 00 02 03 00 00 06 09 21 00 01 00 01 22 21 00 07 .......!...."!.. 00000060: 05 81 03 40 00 01 07 05 01 03 40 00 01 08 0B 01 ...@......@..... 00000070: 02 02 02 01 04 09 04 01 00 01 02 02 01 04 05 24 ...............$ 00000080: 00 10 01 05 24 01 03 02 04 24 02 06 05 24 06 01 ....$....$...$.. 00000090: 02 07 05 83 03 10 00 20 09 04 02 00 02 0A 00 00 ....... ........ (...)
Matplotlib is a nice Matlab-like environment for Python. If you encounter a backend related problem while using Matplotlib [1] on a Python Virtualenv [2], then you need to explicitly select one (i.e. backend : Qt5Agg) in a ~/.config/matplotlib/matplotlibrc (or directly in a matplotlib file located in current working directory) configuration file. Then remember to use modern interpreter and meet dependencies requirements. Example below:
$ mkdir ~/.matplotlib $ echo "backend : Qt5Agg" >> ~/.config/matplotlib/matplotlibrc $ echo "backend : Qt5Agg" >> matplotlibrc $ python3.6 -m venv venv-mac-36 $ source venv-mac-36/bin/activate $ which python $ pip install matplotlib pyqt5
Now you can use Matplotlib inside created Python Virtualenv (assuming you had Python 3.6 and Qt5 [3] already installed on your system). Other backends are: TKAgg, GTKAgg, Qt4Agg, Qt5Agg, WXAgg [4].
[1] https://matplotlib.org/
[2] https://www.python.org/
[3] https://www.qt.io/
[4] https://matplotlib.org/faq/usage_faq.html
If you want to install additional Python [1] modules inside your Blender [2] environment, you can install PIP using this recommended script [3], then use PIP to install all modules that you want. Note Blender’s Python Virtualenv location is /path_to_blender/blender_version/python/bin/python and you need to use this particular interpreter to launch the script.
[1] https://www.python.org/
[2] https://www.blender.org/
[3] https://pip.pypa.io/en/stable/installing/
Python 3.6.0 NumPy and SciPy from MacPorts crash on import bug [1].
[1] https://trac.macports.org/ticket/53453