It is a basic question, I guess.
I can run my program in Pycharm 2018.1 Python 3.6.5. But when I run in debug mode and open python console, I get this error message when I try to key in any python command.
I am using virtualenv and added interpreter in project setting.
I wonder what's wrong with my configuration
below is stacktrace
Traceback (most recent call last):
File "/Applications/PyCharm CE.app/Contents/helpers/pydev/pydevconsole.py", line 362, in get_interpreter
interpreterInterface = getattr(__builtin__, 'interpreter')
AttributeError: module 'builtins' has no attribute 'interpreter'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Applications/PyCharm CE.app/Contents/helpers/pydev/_pydevd_bundle/pydevd_comm.py", line 1443, in do_it
result = pydevconsole.console_exec(self.thread_id, self.frame_id, self.expression, dbg)
File "/Applications/PyCharm CE.app/Contents/helpers/pydev/pydevconsole.py", line 467, in console_exec
need_more = exec_code(CodeFragment(expression), updated_globals, frame.f_locals, dbg)
File "/Applications/PyCharm CE.app/Contents/helpers/pydev/pydevconsole.py", line 383, in exec_code
interpreterInterface = get_interpreter()
File "/Applications/PyCharm CE.app/Contents/helpers/pydev/pydevconsole.py", line 364, in get_interpreter
interpreterInterface = InterpreterInterface(None, None, threading.currentThread())
File "/Applications/PyCharm CE.app/Contents/helpers/pydev/_pydev_bundle/pydev_ipython_console.py", line 24, in __init__
self.interpreter = get_pydev_frontend(host, client_port)
File "/Applications/PyCharm CE.app/Contents/helpers/pydev/_pydev_bundle/pydev_ipython_console_011.py", line 461, in get_pydev_frontend
_PyDevFrontEndContainer._instance = _PyDevFrontEnd()
File "/Applications/PyCharm CE.app/Contents/helpers/pydev/_pydev_bundle/pydev_ipython_console_011.py", line 310, in __init__
self.ipython = PyDevTerminalInteractiveShell.instance()
File "/Users/hobart/envs/pys/lib/python3.6/site-packages/traitlets/config/configurable.py", line 412, in instance
inst = cls(*args, **kwargs)
File "/Users/hobart/envs/pys/lib/python3.6/site-packages/IPython/terminal/interactiveshell.py", line 430, in __init__
super(TerminalInteractiveShell, self).__init__(*args, **kwargs)
File "/Users/hobart/envs/pys/lib/python3.6/site-packages/IPython/core/interactiveshell.py", line 516, in __init__
self.init_completer()
File "/Applications/PyCharm CE.app/Contents/helpers/pydev/_pydev_bundle/pydev_ipython_console_011.py", line 234, in init_completer
self.Completer = self._new_completer_500()
File "/Applications/PyCharm CE.app/Contents/helpers/pydev/_pydev_bundle/pydev_ipython_console_011.py", line 196, in _new_completer_500
parent=self
File "/Applications/PyCharm CE.app/Contents/helpers/pydev/_pydev_bundle/pydev_ipython_console_011.py", line 87, in __init__
self.matchers.remove(self.python_matches)
ValueError: list.remove(x): x not in list
This was fixed few days after your question: https://youtrack.jetbrains.com/issue/PY-29313
You should update your PyCharm to 2018.1.1 or higher.
I had exactly the same problem after trying to install some packages into the virtual environment. For me it was solved by recreating the environment.
Related
I have always been able to launch spyder without any issues. But today I started running into the following error messages. I don't understand why is it complaining no workingdir? How do I resolve this, as I cannot even launch spyder ?
Traceback (most recent call last):
File "C:\Users\xxx\AppData\Local\miniconda\envs\py3_10\Scripts\spyder-script.py", line 10, in <module>
sys.exit(main())
File "C:\Users\xxx\AppData\Local\miniconda\envs\py3_10\lib\site-packages\spyder\app\start.py", line 253, in main
mainwindow.main(options, args)
File "C:\Users\xxx\AppData\Local\miniconda\envs\py3_10\lib\site-packages\spyder\app\mainwindow.py", line 1956, in main
mainwindow = create_window(MainWindow, app, splash, options, args)
File "C:\Users\xxx\AppData\Local\miniconda\envs\py3_10\lib\site-packages\spyder\app\utils.py", line 289, in create_window
main.setup()
File "C:\Users\xxx\AppData\Local\miniconda\envs\py3_10\lib\site-packages\spyder\app\mainwindow.py", line 771, in setup
PLUGIN_REGISTRY.register_plugin(self, PluginClass,
File "C:\Users\xxx\AppData\Local\miniconda\envs\py3_10\lib\site-packages\spyder\api\plugin_registration\registry.py", line 342, in register_plugin
instance = self._instantiate_spyder5_plugin(
File "C:\Users\xxx\AppData\Local\miniconda\envs\py3_10\lib\site-packages\spyder\api\plugin_registration\registry.py", line 193, in _instantiate_spyder5_plugin
plugin_instance.initialize()
File "C:\Users\xxx\AppData\Local\miniconda\envs\py3_10\lib\site-packages\spyder\api\plugins\new_api.py", line 669, in initialize
self.on_initialize()
File "C:\Users\xxx\AppData\Local\miniconda\envs\py3_10\lib\site-packages\spyder\plugins\workingdirectory\plugin.py", line 82, in on_initialize
container.set_history(
File "C:\Users\xxx\AppData\Local\miniconda\envs\py3_10\lib\site-packages\spyder\plugins\workingdirectory\container.py", line 323, in set_history
workdir = self._get_init_workdir()
File "C:\Users\xxx\AppData\Local\miniconda\envs\py3_10\lib\site-packages\spyder\plugins\workingdirectory\container.py", line 183, in _get_init_workdir
workdir = self.get_conf('startup/fixed_directory')
File "C:\Users\xxx\AppData\Local\miniconda\envs\py3_10\lib\site-packages\spyder\api\config\mixins.py", line 76, in get_conf
return CONF.get(section, option, default)
File "C:\Users\xxx\AppData\Local\miniconda\envs\py3_10\lib\site-packages\spyder\config\manager.py", line 499, in get
value = config.get(section=section, option=option, default=default)
File "C:\Users\xxx\AppData\Local\miniconda\envs\py3_10\lib\site-packages\spyder\config\user.py", line 980, in get
return config.get(section=section, option=option, default=default)
File "C:\Users\xxx\AppData\Local\miniconda\envs\py3_10\lib\site-packages\spyder\config\user.py", line 511, in get
raise cp.NoSectionError(section)
configparser.NoSectionError: No section: 'workingdir'
My computer shut down while running a simple code on Spyder. Ever since it has restarted, it seems that /Users/fp/.ipython has not been found anymore.
To be more specific, I run:
ipython3
And I get the following error message:
Traceback (most recent call last):
File "/Users/fp/opt/anaconda3/lib/python3.9/site-packages/traitlets/traitlets.py", line 537, in get
value = obj._trait_values[self.name]
KeyError: 'ipython_dir'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Users/fp/opt/anaconda3/bin/ipython3", line 11, in <module>
sys.exit(start_ipython())
File "/Users/fp/opt/anaconda3/lib/python3.9/site-packages/IPython/__init__.py", line 130, in start_ipython
return launch_new_instance(argv=argv, **kwargs)
File "/Users/fp/opt/anaconda3/lib/python3.9/site-packages/traitlets/config/application.py", line 845, in launch_instance
app.initialize(argv)
File "/Users/fp/opt/anaconda3/lib/python3.9/site-packages/traitlets/config/application.py", line 88, in inner
return method(app, *args, **kwargs)
File "/Users/fp/opt/anaconda3/lib/python3.9/site-packages/IPython/terminal/ipapp.py", line 308, in initialize
super(TerminalIPythonApp, self).initialize(argv)
File "/Users/fp/opt/anaconda3/lib/python3.9/site-packages/traitlets/config/application.py", line 88, in inner
return method(app, *args, **kwargs)
File "/Users/fp/opt/anaconda3/lib/python3.9/site-packages/IPython/core/application.py", line 458, in initialize
self.init_profile_dir()
File "/Users/fp/opt/anaconda3/lib/python3.9/site-packages/IPython/core/application.py", line 362, in init_profile_dir
p = ProfileDir.find_profile_dir_by_name(self.ipython_dir, self.profile, self.config)
File "/Users/fp/opt/anaconda3/lib/python3.9/site-packages/traitlets/traitlets.py", line 577, in __get__
return self.get(obj, cls)
File "/Users/fp/opt/anaconda3/lib/python3.9/site-packages/traitlets/traitlets.py", line 540, in get
default = obj.trait_defaults(self.name)
File "/Users/fp/opt/anaconda3/lib/python3.9/site-packages/traitlets/traitlets.py", line 1580, in trait_defaults
return self._get_trait_default_generator(names[0])(self)
File "/Users/fp/opt/anaconda3/lib/python3.9/site-packages/traitlets/traitlets.py", line 977, in __call__
return self.func(*args, **kwargs)
File "/Users/fp/opt/anaconda3/lib/python3.9/site-packages/IPython/core/application.py", line 174, in _ipython_dir_default
d = get_ipython_dir()
File "/Users/fp/opt/anaconda3/lib/python3.9/site-packages/IPython/paths.py", line 70, in get_ipython_dir
os.makedirs(ipdir, exist_ok=True)
File "/Users/fp/opt/anaconda3/lib/python3.9/os.py", line 225, in makedirs
mkdir(name, mode)
FileNotFoundError: [Errno 2] No such file or directory: '/Users/fp/.ipython'
I checked and indeed I do not have a /Users/fp/.ipython folder. On the contrary, I still have a /Users/fp/.jupyter folder for example.
ipython3 --version
7.31.1
conda --version
conda 22.9.0
python3 --version
Python 3.9.13
Anyone could help me with that?
Thank you
I have been using the library misty for one month and it's working on my personal laptop. But when I am trying to make it work on the another device it gives an error:
Traceback (most recent call last):
File "client.py", line 577, in <module>
main()
File "client.py", line 558, in main
this_device, args.ini.address,
File "client.py", line 57, in __init__
MSTPSimpleApplication.__init__(self, *args)
File "/###/###/venv/lib/python3.7/python3.7/site-packages/misty/mstplib/__init__.py", line 531, in __init__
self.mux = MSTPMultiplexer(self.localDevice, self.localAddress)
File "/###/###/venv/lib/python3.7/python3.7/site-packages/misty/mstplib/__init__.py", line 428, in __init__
self.directPort = MSTPDirector(self.localDevice, self.address)
File "/###/###/venv/lib/python3.7/python3.7/site-packages/misty/mstplib/__init__.py", line 203, in __init__
mstp_lib = cdll.LoadLibrary(libmstp_path)
File "/usr/lib/python3.7/ctypes/__init__.py", line 442, in LoadLibrary
return self._dlltype(name)
File "/usr/lib/python3.7/ctypes/__init__.py", line 364, in __init__
self._handle = _dlopen(self._name, mode)
OSError: /###/###/venv/lib/python3.7/site-packages/misty/mstplib/libmstp_agent.so: cannot open shared object file: No such file or directory
How can I fix this?
Thanks in anticipation.
I am currently trying to figure out how to use netmiko to automate some of my routine work.Such as getting configuration backup, creating vlans etc.I've managed to use it on Aruba and Huawei Switches without problem.But on alcatel switch I'm facing this issue:
Unknown exception: module 'cryptography.utils' has no attribute 'bit_length'
Traceback (most recent call last):
File "C:\Users\melih.celik\AppData\Local\Programs\Python\Python39\lib\site-packages\paramiko\transport.py", line 2075, in run
self.kex_engine.parse_next(ptype, m)
File "C:\Users\melih.celik\AppData\Local\Programs\Python\Python39\lib\site-packages\paramiko\kex_gex.py", line 101, in parse_next
return self._parse_kexdh_gex_reply(m)
File "C:\Users\melih.celik\AppData\Local\Programs\Python\Python39\lib\site-packages\paramiko\kex_gex.py", line 281, in _parse_kexdh_gex_reply
self.transport._verify_key(host_key, sig)
File "C:\Users\melih.celik\AppData\Local\Programs\Python\Python39\lib\site-packages\paramiko\transport.py", line 1886, in _verify_key
if not key.verify_ssh_sig(self.H, Message(sig)):
File "C:\Users\melih.celik\AppData\Local\Programs\Python\Python39\lib\site-packages\paramiko\dsskey.py", line 148, in verify_ssh_sig
key = dsa.DSAPublicNumbers(
File "C:\Users\melih.celik\AppData\Local\Programs\Python\Python39\lib\site-packages\cryptography\hazmat\primitives\asymmetric\dsa.py", line 212, in public_key
return backend.load_dsa_public_numbers(self)
File "C:\Users\melih.celik\AppData\Local\Programs\Python\Python39\lib\site-packages\cryptography\hazmat\backends\openssl\backend.py", line 871, in load_dsa_public_numbers
dsa._check_dsa_parameters(numbers.parameter_numbers)
File "C:\Users\melih.celik\AppData\Local\Programs\Python\Python39\lib\site-packages\netmiko\tplink\tplink_jetstream.py", line 145, in _override_check_dsa_parameters
if crypto_utils.bit_length(parameters.q) not in [160, 256]:
AttributeError: module 'cryptography.utils' has no attribute 'bit_length'
Traceback (most recent call last):
File "C:\Users\melih.celik\Desktop\New_Backup\Yedek\Coding\Rand stuff\ssh_deneme(toplu).py", line 75, in
config_backup(cihaz_secim,ip_address,username,password)
File "C:\Users\melih.celik\Desktop\New_Backup\Yedek\Coding\Rand stuff\ssh_deneme(toplu).py", line 12, in config_backup
net_connect=ConnectHandler(**switch) #Baglanti kuruldu.
File "C:\Users\melih.celik\AppData\Local\Programs\Python\Python39\lib\site-packages\netmiko\ssh_dispatcher.py", line 312, in ConnectHandler
return ConnectionClass(*args, **kwargs)
File "C:\Users\melih.celik\AppData\Local\Programs\Python\Python39\lib\site-packages\netmiko\base_connection.py", line 346, in init
self._open()
File "C:\Users\melih.celik\AppData\Local\Programs\Python\Python39\lib\site-packages\netmiko\base_connection.py", line 351, in _open
self.establish_connection()
File "C:\Users\melih.celik\AppData\Local\Programs\Python\Python39\lib\site-packages\netmiko\base_connection.py", line 920, in establish_connection
self.remote_conn_pre.connect(**ssh_connect_params)
File "C:\Users\melih.celik\AppData\Local\Programs\Python\Python39\lib\site-packages\paramiko\client.py", line 406, in connect
t.start_client(timeout=timeout)
File "C:\Users\melih.celik\AppData\Local\Programs\Python\Python39\lib\site-packages\paramiko\transport.py", line 660, in start_client
raise e
File "C:\Users\melih.celik\AppData\Local\Programs\Python\Python39\lib\site-packages\paramiko\transport.py", line 2075, in run
self.kex_engine.parse_next(ptype, m)
File "C:\Users\melih.celik\AppData\Local\Programs\Python\Python39\lib\site-packages\paramiko\kex_gex.py", line 101, in parse_next
return self._parse_kexdh_gex_reply(m)
File "C:\Users\melih.celik\AppData\Local\Programs\Python\Python39\lib\site-packages\paramiko\kex_gex.py", line 281, in _parse_kexdh_gex_reply
self.transport._verify_key(host_key, sig)
File "C:\Users\melih.celik\AppData\Local\Programs\Python\Python39\lib\site-packages\paramiko\transport.py", line 1886, in _verify_key
if not key.verify_ssh_sig(self.H, Message(sig)):
File "C:\Users\melih.celik\AppData\Local\Programs\Python\Python39\lib\site-packages\paramiko\dsskey.py", line 148, in verify_ssh_sig
key = dsa.DSAPublicNumbers(
File "C:\Users\melih.celik\AppData\Local\Programs\Python\Python39\lib\site-packages\cryptography\hazmat\primitives\asymmetric\dsa.py", line 212, in public_key
return backend.load_dsa_public_numbers(self)
File "C:\Users\melih.celik\AppData\Local\Programs\Python\Python39\lib\site-packages\cryptography\hazmat\backends\openssl\backend.py", line 871, in load_dsa_public_numbers
dsa._check_dsa_parameters(numbers.parameter_numbers)
File "C:\Users\melih.celik\AppData\Local\Programs\Python\Python39\lib\site-packages\netmiko\tplink\tplink_jetstream.py", line 145, in _override_check_dsa_parameters
if crypto_utils.bit_length(parameters.q) not in [160, 256]:
AttributeError: module 'cryptography.utils' has no attribute 'bit_length'
Thanks for your help in advance.
It looks like tplink_jetstream.py assumes that a (now removed) helper function is available to it. The simplest fix here would be to go into that file and modify the line containing crypto_utils.bit_length(parameters.q) to read parameters.q.bit_length() instead.
I am using Eclipse Neon with Pydev plugin on Windows 10. The python interpreter is Anaconda3.
Some time ago the fetch completion stopped working in debug mode and I am getting the error message below. I upgraded to Photon but still not working. Any help to resolve this will be highly appreciated. Thank you!
Unexpected XML error. Payload:
Error in fetching completionsTraceback (most recent call last):
File "C:\Users\nathan\.p2\pool\plugins\org.python.pydev.
core_6.4.3.201807050139\pysrc\pydevconsole.py", line 449, in
get_interpreter
interpreterInterface = getattr(__builtin__, 'interpreter')
AttributeError: module 'builtins' has no attribute 'interpreter'
During handling of the above exception, another exception
occurred:
Traceback (most recent call last):
File "C:\Users\nathan\.p2\pool\plugins\org.python.pydev.
core_6.4.3.201807050139\pysrc\_pydevd_bundle\pydevd_comm.
py", line 1463, in do_it
completions_xml = pydevd_console.get_completions(frame,
self.act_tok)
File "C:\Users\nathan\.p2\pool\plugins\org.python.pydev.
core_6.4.3.201807050139\pysrc\_pydevd_bundle\pydevd_console.
py", line 248, in get_completions
return _pydev_completer.generate_completions_as_xml(frame,
act_tok)
File "C:\Users\nathan\.p2\pool\plugins\org.python.pydev.
core_6.4.3.201807050139\pysrc\_pydev_bundle\_pydev_completer.
py", line 167, in generate_completions_as_xml
completions = pydevconsole.get_completions(act_tok, act_tok,
updated_globals, frame.f_locals)
File "C:\Users\nathan\.p2\pool\plugins\org.python.pydev.
core_6.4.3.201807050139\pysrc\pydevconsole.py", line 460, in
get_completions
interpreterInterface = get_interpreter()
File "C:\Users\nathan\.p2\pool\plugins\org.python.pydev.
core_6.4.3.201807050139\pysrc\pydevconsole.py", line 451, in
get_interpreter
interpreterInterface = InterpreterInterface(None, None,
threading.currentThread())
File "C:\Users\nathan\.p2\pool\plugins\org.python.pydev.
core_6.4.3.201807050139
\pysrc\_pydev_bundle\pydev_ipython_console.py", line 25, in
__init__
self.interpreter = get_pydev_frontend(host, client_port)
File "C:\Users\nathan\.p2\pool\plugins\org.python.pydev.
core_6.4.3.201807050139
\pysrc\_pydev_bundle\pydev_ipython_console_011.py", line 491,
in get_pydev_frontend
_PyDevFrontEndContainer._instance = _PyDevFrontEnd()
File "C:\Users\nathan\.p2\pool\plugins\org.python.pydev.
core_6.4.3.201807050139
\pysrc\_pydev_bundle\pydev_ipython_console_011.py", line 340,
in __init__
self.ipython = PyDevTerminalInteractiveShell.instance()
File "C:
\Users\nathan\AppData\Local\Continuum\anaconda3\lib\site-
packages\traitlets\config\configurable.py", line 412, in instance
inst = cls(*args, **kwargs)
File "C:
\Users\nathan\AppData\Local\Continuum\anaconda3\lib\site-
packages\IPython\terminal\interactiveshell.py", line 425, in
__init__
super(TerminalInteractiveShell, self).__init__(*args, **kwargs)
File "C:
\Users\nathan\AppData\Local\Continuum\anaconda3\lib\site-
packages\IPython\core\interactiveshell.py", line 488, in __init__
self.init_completer()
File "C:\Users\nathan\.p2\pool\plugins\org.python.pydev.
core_6.4.3.201807050139
\pysrc\_pydev_bundle\pydev_ipython_console_011.py", line 262,
in init_completer
self.Completer = self._new_completer_600()
File "C:\Users\nathan\.p2\pool\plugins\org.python.pydev.
core_6.4.3.201807050139
\pysrc\_pydev_bundle\pydev_ipython_console_011.py", line 224,
in _new_completer_600
parent=self
File "C:\Users\nathan\.p2\pool\plugins\org.python.pydev.
core_6.4.3.201807050139
\pysrc\_pydev_bundle\pydev_ipython_console_011.py", line 95, in
__init__
IPCompleter.__init__(self, *args, **kwargs)
File "C:
\Users\nathan\AppData\Local\Continuum\anaconda3\lib\site-
packages\IPython\core\completer.py", line 1110, in __init__
self.dict_key_matches,
AttributeError: can't set attribute
Alright, I cracked it, at least for myself.
Updated pydev via the Eclipse Help...Check for Updates - Installed latest available.
AND
pip uninstall ipython (6.2.1)
pip install ipython (6.5)
The latter got it to work, not sure if the former was required.