UPWORK/ODESK guru: Tips and Tricks for clients

skype: upwork.link , email: info@upwork.link

Archive for the ‘Python snake’ Category

Как распечатать полную трассировку кода скрипта python без остановки?

without comments

Для отладки можно все увидеть в текущей трассировке стека, вызвав:

1
  traceback.print_stack()

И нет необходимости вручную поднимать исключение, чтобы снова поймать его.

или в подробностях:

https://docs.python.org/2.7/library/traceback.html#traceback.print_stack
https://docs.python.org/3/library/traceback.html#traceback.print_stack

Written by spectre

December 27th, 2017 at 6:36 pm

Posted in Python snake

openSUSE: установить альтернативную версию python без изменения версии по умолчанию

without comments

Если вам нужно поддерживать разные версии одновременно, лучше всего установить их в свое дерево. configure принимает необязательный аргумент –prefix =/path/to/installation/root.
Мы могли бы установить дополнительный программный пакет в виде файла /opt/local/x86_64-linux-gnu/python-2.6.6. Пользователи, которым нужна эта конкретная версия, могут затем добавить /opt/local/x86_64-linux-gnu/python-2.6.6/bin к их $ PATH или использовать virtualenvили GNU stow .

Для примера следующий набор шагов:

Read the rest of this entry »

Written by spectre

November 27th, 2017 at 3:54 pm

Posted in Python snake

pip – to show all versions of package

without comments

(.venv) [homitaka@tayn1 ~]$ pip install python-novaclient==
Collecting python-novaclient==
  Could not find a version that satisfies the requirement python-novaclient== (from versions: 2.6.0, 2.6.0.1, 2.6.10, 2.7.0, 2.8.0, 2.9.0, 2.10.0, 2.11.0, 2.11.1, 2.12.0, 2.13.0, 2.14.0, 2.14.1, 2.15.0, 2.16.0, 2.17.0, 2.18.0, 2.18.1, 2.19.0, 2.20.0, 2.21.0, 2.22.0, 2.23.0, 2.23.1, 2.23.2, 2.23.3, 2.24.0, 2.24.1, 2.25.0, 2.26.0, 2.27.0, 2.28.0, 2.28.1, 2.29.0, 2.30.0, 2.30.1, 2.30.2, 2.30.3, 2.31.0, 2.32.0, 2.33.0, 2.34.0, 2.35.0, 3.0.0, 3.1.0, 3.2.0, 3.3.0, 3.3.1, 3.3.2, 3.4.0, 4.0.0, 4.1.0, 5.0.0, 5.1.0, 6.0.0, 6.0.1, 7.0.0, 7.1.0, 7.1.1, 8.0.0)
No matching distribution found for python-novaclient==
(.venv) [homitaka@tayn1 ~]$

Written by spectre

May 15th, 2017 at 9:25 pm

5 – five-minute introduction to the module logging Python

without comments

The use of pirnt is suitable for those programmers who have enough time. But it’s better to use logging. In addition, learn to use the Python debugger for debugging errors and Pylint to prevent errors and to make the code more readable.
In order to display the log messages on the screen, use the following code:

Read the rest of this entry »

Written by spectre

May 7th, 2017 at 2:35 pm

Own installation Ganeti Web Manager + own Python environment + localization (by desire).

without comments

Актуально для текущей-последней версии GWM (в репозитории pip), для Python 2.17.13 (собственная оригинальная инсталляция в /opt).
Apache 2.4, Ganeti 2.15.2 on CentOS7.

Read the rest of this entry »

Written by spectre

March 4th, 2017 at 3:33 pm

Additional version of Python 2.7.* from source code, local pip and mod_wsgi on Apache2.4

without comments

Python – bunch of difficult sets of scripts on 80%. It is have own pros and cons. Very often – it is problems of difficult dependencies of application, when in OS we see old version of Python interpretator.
Building own version from source is the most appropriate variant of solving if need to use it only for local application in environment of some user or web servers.
Here is sample of commands of shell for getting copy of installation of Python in special directory – /opt.

Read the rest of this entry »

Written by spectre

March 2nd, 2017 at 11:07 am

Posted in Python snake