command prompt returning blank when I give command of python - python-3.8

I am using windows 10 OS.
nothing appears when I type python on cmd
C:\Users\username>python
C:\Users\username>
but it does when I type py
C:\Users\username>py
Python 3.8.3 (tags/v3.8.3:6f8c832, May 13 2020, 22:37:02) [MSC v.1924 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>>
and also when I try to open any python file directly it fails to open it.

Related

Netmiko - Windows 10 - SSH Router - Not able to run 1st command only

>>> from netmiko import ConnectHandler
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Python27\lib\site-packages\netmiko\__init__.py", line 7, in <module>
Hello Experts,
Post applying from netmiko import ConnectHandler command I am getting above error.
Setup - Windows 10, Python 3.7, Netmiko installed. no other file present in pc with name netmiko.py.
Please suggest solution.
In order to use Netmiko, you need to be in the same python environment that you installed netmiko.
I see you installed Windows 10 and Python 3.7, but the python that is being used to call Netmiko is 2.7. You can tell from the "Python27" in the directory name C:\Python27\lib\site-packages\netmiko\__init__.py.
Run a Python 3.7 shell and try the command again. Make sure Netmiko is properly installed in the environment.
To verify if netmiko is installed, type help("modules") to retrieve a list of all installed packages. If Netmiko was properly installed, you should see it there.
Python 3.7.5 (tags/v3.7.5:5c02a39a0b, Oct 15 2019, 00:11:34) [MSC v.1916 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> help("modules")
Please wait a moment while I gather a list of all available modules...
---- output omitted ----
Cryptodome bdb gc pyexpat
__future__ binascii genericpath pygments
_string codecs netaddr tabnanny
_strptime codeop netapp tarfile
_struct collections netmiko telnetlib
_symtable colorama netmiko_globals tempfile
_testbuffer colorsys netrc terminal_server
_testcapi compileall nntplib test
_testconsole concurrent nt textfsm
_testimportmultiple configparser ntpath textwrap
_testmultiphase contextlib nturl2path this
_textfsm contextvars numbers threading
I hope this was helpful
Run : python3 to access python version 3.5+ terminal.
>>>from netmiko import ConnectHandler

Pycharm os.get_terminal_size() not working

Python 3.7.1 on Ubuntu 18.04.2 LTS
Using Pycharm version:
PyCharm 2019.1.3 (Professional Edition)
Build #PY-191.7479.30, built on May 30, 2019
Linux 4.18.0-22-generic
I'm having issues with the os.get_terminal_size() function call
Running the command from the terminal window works:
Python 3.7.1 (default, Oct 22 2018, 11:21:55)
[GCC 8.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import os
>>> os.get_terminal_size()
os.terminal_size(columns=223, lines=18)
But running it from the Python Console window doesn't
>>>import os
>>>os.get_terminal_size()
Traceback (most recent call last):
File "<input>", line 1, in <module>
OSError: [Errno 25] Inappropriate ioctl for device
My googling hasn't produced much information specific to my issue at hand. What does OSError: [Errno 25] Inappropriate ioctl for device actually mean and how do I fix it?
Your implementation of Python relies on the terminal being compliant to the request for the terminal size by the OS. In the CPython implementation, the system call in ioctl() will fail because the device (terminal) doesn't recognize the command. You can try to set
-Drun.processes.with.pty=true
in Help/Edit Custom VM Options... as per this answer.
Instead of using os you can use shutil. This works without any hitch in Pycharm (and hopefully, by extension, IntelliJ).
import shutil
terminal_size = shutil.get_terminal_size(fallback=(120, 50))
# attributes
print('cols=', terminal_size.columns)
print('rows=', terminal_size.rows)

import tensorflow in a Jython session?

I am wondering whether importing Tensorflow in a jython session is feasible and if so, how shall I configure my environment to get it running.
Of course, using python, importing Tensorflow works as expected. Is Tensorflow compatible with Jython ?
[mata] /home/mata/mlp > python
imPython 2.7.12 |Continuum Analytics, Inc.| (default, Jul 2 2016, 17:42:40) [GCC 4.4.7 20120313 (Red Hat 4.4.7-1)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
Anaconda is brought to you by Continuum Analytics.
Please check out: http://continuum.io/thanks and https://anaconda.org
>>> import tensorflow as tf
>>>
whereas with Jython
[mata] /home/mata/mlp > jython
Jython 2.7.0 (default:9987c746f838, Apr 29 2015, 02:25:11)
[Java HotSpot(TM) 64-Bit Server VM (Oracle Corporation)] on java1.8.0_101
Type "help", "copyright", "credits" or "license" for more information.
>>> import tensorflow as tf
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named tensorflow
>>>
Update:
I tried to load the libtensorflow JAR but still, I seem to be missing something here...
>>> import sys
>>> sys.path.append("libtensorflow-1.2.1.jar")
>>> help(tf) # OK
but I must be missing some obvious step to get the hello Tensorflow case work...
No, Jython won't work with Python modules that use C/C++.
The jar you're trying to use is for the Java API (over JNI), so guess you've already seen https://www.tensorflow.org/install/install_java

unable to figure out which package update lead to change of CA certs location for python requests package

I am trying to figure out which package update could have lead to change in the default CA location for python requests package. Listed below is my findings on 2 different nodes running RHEL 7.
One can check what cert-store is being used by requests package as specified below:
[root#compute-01 test]# python -mrequests.certs
/etc/pki/tls/certs/ca-bundle.crt
[root#compute-01 test]# openssl version
OpenSSL 1.0.1e-fips 11 Feb 2013
[root#compute-01 test]# python
Python 2.7.5 (default, Oct 11 2015, 17:47:16)
[GCC 4.8.3 20140911 (Red Hat 4.8.3-9)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import requests
>>> requests.__version__
'2.7.0'
The same thing on the other node is as follows:-
[root#compute-25 test]# python -m requests.certs
/usr/lib/python2.7/site-packages/requests/cacert.pem
[root#compute-25 test]# openssl version
OpenSSL 1.0.1e-fips 11 Feb 2013
[root#compute-25 test]# python
Python 2.7.5 (default, Oct 11 2015, 17:47:16)
[GCC 4.8.3 20140911 (Red Hat 4.8.3-9)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import requests
>>> requests.__version__
'2.7.0'
I am unable to figure out which package might have got upgraded which lead to this. I am unable to figure out what next I should check. Kindly advise.
One version of requests (the former) was installed by your system package manager and the latter was installed by pip.

Eye of Gnome Python plugins won't autogen because check for PYGTK fails

Presenting symptom: autogen disables the build of slideshowshuffle and pythonconsole, reporting "no python support." Platform is Ubuntu 9.04, Jaunty Jackalope; Gnome 2.26.1.
Log extract:
checking for a Python interpreter with version >= 2.3... python
checking for python... /usr/bin/python
checking for python version... 2.6
checking for python platform... linux2
checking for python script directory... ${prefix}/lib/python2.6/site-packages
checking for python extension module directory... ${exec_prefix}/lib/python2.6/site-packages
checking for PYGTK... no
configure: WARNING: Python not found, disabling python support
Evidence that both python and pygtk are installed:
Python 2.6.2 (release26-maint, Apr 19 2009, 01:56:41)
[GCC 4.3.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import pygtk
>>>
I note the capitalization of PYGTK, which is common for environment variables. There is no PYGTK environment variable.
Your search - "PYGTK environment
variable" - did not match any
documents.
A grep for PYGTK in the tree rooted from /usr/share/doc/python-gtk2-doc/html returned no rows.
Try installing "python-gtk2-dev" package. You can make sure you have it with
pkg-config --list-all | grep pygtk-2.0
I think, the one you're using from python is "python-gtk2".