Hi jar,
Could see the same problem, it seems to be PyEZ related. Some changes have been made and it works for me from this version on GIT: https://github.com/Juniper/py-junos-eznc/pull/902
Could you please install from here and try: pip install git+https://github.com/Juniper/py-junos-eznc.git
Here is my output with the problem and resolution:
C:\Python36\>python dev_facts.py
C:\Python36\\lib\site-packages\paramiko\kex_ecdh_nist.py:39: CryptographyDeprecationWarning: encode_point has been deprecated on EllipticCurvePublicNumbers and will be removed in a future version. Please use EllipticCurvePublicKey.public_bytes to obtain both compressed and uncompressed point encoding.
m.add_string(self.Q_C.public_numbers().encode_point())
C:\Python36\\lib\site-packages\paramiko\kex_ecdh_nist.py:96: CryptographyDeprecationWarning: Support for unsafe construction of public numbers from encoded data will be removed in a future version. Please use EllipticCurvePublicKey.from_encoded_point
self.curve, Q_S_bytes
C:\Python36\\lib\site-packages\paramiko\kex_ecdh_nist.py:111: CryptographyDeprecationWarning: encode_point has been deprecated on EllipticCurvePublicNumbers and will be removed in a future version. Please use EllipticCurvePublicKey.public_bytes to obtain both compressed and uncompressed point encoding.
hm.add_string(self.Q_C.public_numbers().encode_point())
*****************************
Traceback (most recent call last):
File "dev_facts.py", line 12, in <module>
print(json.dumps(dev.facts))
File "C:\Python36\\lib\json\__init__.py", line 231, in dumps
return _default_encoder.encode(obj)
File "C:\Python36\\lib\json\encoder.py", line 199, in encode
chunks = self.iterencode(o, _one_shot=True)
File "C:\Python36\\lib\json\encoder.py", line 257, in iterencode
return _iterencode(o, 0)
File "C:\Python36\\lib\site-packages\jnpr\junos\factory\to_json.py", line 57, in default
obj = super(PyEzJSONEncoder, self).default(obj)
File "C:\Python36\\lib\json\encoder.py", line 180, in default
o.__class__.__name__)
TypeError: Object of type '_FactCache' is not JSON serializable
C:\Python36\>cd Scripts
C:\Python36\>pip list
Package Version
------------ -------
asn1crypto 0.24.0
bcrypt 3.1.6
cffi 1.12.1
cryptography 2.5
Jinja2 2.10
junos-eznc 2.2.0
lxml 4.3.1
MarkupSafe 1.1.1
ncclient 0.6.3
netaddr 0.7.19
paramiko 2.4.2
pip 18.1
pyasn1 0.4.5
pycparser 2.19
PyNaCl 1.3.0
pyserial 3.4
PyYAML 3.13
scp 0.13.0
selectors2 2.0.1
setuptools 40.6.2
six 1.12.0
You are using pip version 18.1, however version 19.0.3 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.
C:\Python36\>
C:\Python36\>cd ..
C:\Python36\>python
Python 3.6.8 (tags/v3.6.8:3c6b436a57, Dec 24 2018, 00:16:47) [MSC v.1916 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> from jnpr.junos import version
>>> print (version.VERSION)
2.2.0
>>>
>>> quit()
C:\Python36\>cd Scripts
C:\Python36\>pip list
Package Version
------------ -------
asn1crypto 0.24.0
bcrypt 3.1.6
cffi 1.12.1
cryptography 2.5
Jinja2 2.10
junos-eznc 2.2.0
lxml 4.3.1
MarkupSafe 1.1.1
ncclient 0.6.3
netaddr 0.7.19
paramiko 2.4.2
pip 18.1
pyasn1 0.4.5
pycparser 2.19
PyNaCl 1.3.0
pyserial 3.4
PyYAML 3.13
scp 0.13.0
selectors2 2.0.1
setuptools 40.6.2
six 1.12.0
You are using pip version 18.1, however version 19.0.3 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.
C:\Python36\>pip install git+https://github.com/Juniper/py-junos-eznc.git
Collecting git+https://github.com/Juniper/py-junos-eznc.git
Cloning https://github.com/Juniper/py-junos-eznc.git to c:\users\mriyaz\appdata\local\temp\pip-req-build-yhi76beq
Requirement already satisfied: lxml>=3.2.4 in C:\Python36\\lib\site-packages (from junos-eznc==2.2.1.dev0) (4.3.1)
Requirement already satisfied: ncclient>=0.5.4 in C:\Python36\\lib\site-packages (from junos-eznc==2.2.1.dev0) (0.6.3)
Requirement already satisfied: paramiko>=1.15.2 in C:\Python36\\lib\site-packages (from junos-eznc==2.2.1.dev0) (2.4.2)
Requirement already satisfied: scp>=0.7.0 in C:\Python36\\lib\site-packages (from junos-eznc==2.2.1.dev0) (0.13.0)
Requirement already satisfied: jinja2>=2.7.1 in C:\Python36\\lib\site-packages (from junos-eznc==2.2.1.dev0) (2.10)
Requirement already satisfied: PyYAML>=3.10 in C:\Python36\\lib\site-packages (from junos-eznc==2.2.1.dev0) (3.13)
Requirement already satisfied: netaddr in C:\Python36\\lib\site-packages (from junos-eznc==2.2.1.dev0) (0.7.19)
Requirement already satisfied: six in C:\Python36\\lib\site-packages (from junos-eznc==2.2.1.dev0) (1.12.0)
Requirement already satisfied: pyserial in C:\Python36\\lib\site-packages (from junos-eznc==2.2.1.dev0) (3.4)
Requirement already satisfied: setuptools>0.6 in C:\Python36\\lib\site-packages (from ncclient>=0.5.4->junos-eznc==2.2.1.dev0) (40.6.2)
Requirement already satisfied: selectors2>=2.0.1 in C:\Python36\\lib\site-packages (from ncclient>=0.5.4->junos-eznc==2.2.1.dev0) (2.0.1)
Requirement already satisfied: bcrypt>=3.1.3 in C:\Python36\\lib\site-packages (from paramiko>=1.15.2->junos-eznc==2.2.1.dev0) (3.1.6)
Requirement already satisfied: cryptography>=1.5 in C:\Python36\\lib\site-packages (from paramiko>=1.15.2->junos-eznc==2.2.1.dev0) (2.5)
Requirement already satisfied: pyasn1>=0.1.7 in C:\Python36\\lib\site-packages (from paramiko>=1.15.2->junos-eznc==2.2.1.dev0) (0.4.5)
Requirement already satisfied: pynacl>=1.0.1 in C:\Python36\\lib\site-packages (from paramiko>=1.15.2->junos-eznc==2.2.1.dev0) (1.3.0)
Requirement already satisfied: MarkupSafe>=0.23 in C:\Python36\\lib\site-packages (from jinja2>=2.7.1->junos-eznc==2.2.1.dev0) (1.1.1)
Requirement already satisfied: cffi>=1.1 in C:\Python36\\lib\site-packages (from bcrypt>=3.1.3->paramiko>=1.15.2->junos-eznc==2.2.1.dev0) (1.12.1)
Requirement already satisfied: asn1crypto>=0.21.0 in C:\Python36\\lib\site-packages (from cryptography>=1.5->paramiko>=1.15.2->junos-eznc==2.2.1.dev0) (0.24.0)
Requirement already satisfied: pycparser in C:\Python36\\lib\site-packages (from cffi>=1.1->bcrypt>=3.1.3->paramiko>=1.15.2->junos-eznc==2.2.1.dev0) (2.19)
Installing collected packages: junos-eznc
Found existing installation: junos-eznc 2.2.0
Uninstalling junos-eznc-2.2.0:
Successfully uninstalled junos-eznc-2.2.0
Running setup.py install for junos-eznc ... done
Successfully installed junos-eznc-2.2.1.dev0
You are using pip version 18.1, however version 19.0.3 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.
C:\Python36\>cd ..
C:\Python36\>python dev_facts.py
C:\Python36\\lib\site-packages\paramiko\kex_ecdh_nist.py:39: CryptographyDeprecationWarning: encode_point has been deprecated on EllipticCurvePublicNumbers and will be removed in a future version. Please use EllipticCurvePublicKey.public_bytes to obtain both compressed and uncompressed point encoding.
m.add_string(self.Q_C.public_numbers().encode_point())
C:\Python36\\lib\site-packages\paramiko\kex_ecdh_nist.py:96: CryptographyDeprecationWarning: Support for unsafe construction of public numbers from encoded data will be removed in a future version. Please use EllipticCurvePublicKey.from_encoded_point
self.curve, Q_S_bytes
C:\Python36\\lib\site-packages\paramiko\kex_ecdh_nist.py:111: CryptographyDeprecationWarning: encode_point has been deprecated on EllipticCurvePublicNumbers and will be removed in a future version. Please use EllipticCurvePublicKey.public_bytes to obtain both compressed and uncompressed point encoding.
hm.add_string(self.Q_C.public_numbers().encode_point())
*****************************
{"current_re": ["master", "node", "fwdd", "member", "pfem", "re0", "localre"], "domain": "ultralab.juniper.net", "fqdn": "pdx57-br-agg-r4.ultralab.juniper.net", "switch_style": "NONE", "HOME": "/var/home/labroot", "srx_cluster": null, "srx_cluster_id": null, "srx_cluster_redundancy_group": null, "RE_hw_mi": false, "serialnumber": "DE735", "2RE": false, "master": "RE0", "RE0": {"mastership_state": "master", "status": "OK", "model": "RE-PTX1000", "last_reboot_reason": "0x2000:hypervisor reboot", "up_time": "11 days, 4 hours, 59 minutes, 58 seconds"}, "RE1": null, "re_info": {"default": {"0": {"mastership_state": "master", "status": "OK", "model": "RE-PTX1000", "last_reboot_reason": "0x2000:hypervisor reboot"}, "default": {"mastership_state": "master", "status": "OK", "model": "RE-PTX1000", "last_reboot_reason": "0x2000:hypervisor reboot"}}}, "re_master": {"default": "0"}, "junos_info": {"re0": {"text": "17.2R1-S6.3", "object": {"major": [17, 2], "type": "R", "minor": "1-S6", "build": 3}}}, "hostname": "pdx57-br-agg-r4", "hostname_info": {"re0": "pdx57-br-agg-r4"}, "model": "PTX1000", "model_info": {"re0": "PTX1000"}, "version": "17.2R1-S6.3", "version_info": {"major": [17, 2], "type": "R", "minor": "1-S6", "build": 3}, "version_RE0": "17.2R1-S6.3", "version_RE1": null, "vc_capable": false, "vc_mode": null, "vc_fabric": null, "vc_master": null, "ifd_style": "CLASSIC", "personality": "PTX", "virtual": false}
******************************
C:\Python36\>cd Scripts
C:\Python36\>pip --version
pip 18.1 from C:\Python36\\lib\site-packages\pip (python 3.6)
C:\Python36\>cd ..
C:\Python36\>python
Python 3.6.8 (tags/v3.6.8:3c6b436a57, Dec 24 2018, 00:16:47) [MSC v.1916 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> from jnpr.junos import version
>>> print (version.VERSION)
2.2.1.dev0
Hope this helps.
Regards,
-r.
--------------------------------------------------
If this solves your problem, please mark this post as "Accepted Solution."
Kudos are always appreciated :).