I run ubuntu by wsl 2. I use python 3.10 version. Now when I run autopep8 the problem of your below picture comes. How can it be fixed?
when I type autopep8 --in-place -a filename.py ,this problem appears
Traceback (most recent call last):
File "/home/asib/.local/bin/autopep8", line 8, in <module>
sys.exit(main())
File "/home/asib/.local/lib/python3.10/site-packages/autopep8.py", line 4518, in main
results = fix_multiple_files(args.files, args, sys.stdout)
File "/home/asib/.local/lib/python3.10/site-packages/autopep8.py", line 4413, in fix_multiple_files
ret = _fix_file((name, options, output))
File "/home/asib/.local/lib/python3.10/site-packages/autopep8.py", line 4383, in _fix_file
return fix_file(*parameters)
File "/home/asib/.local/lib/python3.10/site-packages/autopep8.py", line 3569, in fix_file
original_source = readlines_from_file(filename)
File "/home/asib/.local/lib/python3.10/site-packages/autopep8.py", line 195, in readlines_from_file
with open_with_encoding(filename) as input_file:
File "/home/asib/.local/lib/python3.10/site-packages/autopep8.py", line 172, in open_with_encoding
encoding = detect_encoding(filename, limit_byte_check=limit_byte_check)
File "/home/asib/.local/lib/python3.10/site-packages/autopep8.py", line 182, in detect_encoding
from lib2to3.pgen2 import tokenize as lib2to3_tokenize
ModuleNotFoundError: No module named 'lib2to3'
I want when I give autopep8 command, it will work.
For example: autopep8 --in-place -a filename.py
Related
i'm reinstalled pip in python and module git-review. i was installs python version 2.7 and 3.9
Command "git review" is worked, i don't know what's happend but now error
Traceback (most recent call last):
File "c:\python27\lib\runpy.py", line 174, in _run_module_as_main
"__main__", fname, loader, pkg_name)
File "c:\python27\lib\runpy.py", line 72, in _run_code
exec code in run_globals
File "C:\Users\esinitsyn\AppData\Roaming\Python\Scripts\git-review.exe\__main__.py", line 9, in <module>
File "C:\Users\esinitsyn\AppData\Roaming\Python\Python27\site-packages\git_review\cmd.py", line 1714, in main
_main()
File "C:\Users\esinitsyn\AppData\Roaming\Python\Python27\site-packages\git_review\cmd.py", line 1690, in _main
(status, output) = run_command_status(cmd)
File "C:\Users\esinitsyn\AppData\Roaming\Python\Python27\site-packages\git_review\cmd.py", line 129, in run_command_status
argv = shlex.split(str(argv[0]))
File "c:\python27\lib\shlex.py", line 279, in split
return list(lex)
File "c:\python27\lib\shlex.py", line 269, in next
token = self.get_token()
File "c:\python27\lib\shlex.py", line 96, in get_token
raw = self.read_token()
File "c:\python27\lib\shlex.py", line 172, in read_token
raise ValueError, "No closing quotation"
ValueError: No closing quotation
Check the python installation and pip from terminal
Python --version in my case its shows Python 3.9.1
pip --version in my case I have pip 21.0.1 from d:\py39\lib\site-package\pip (python 3.9)
try upgrading the pip if throw error just by: pip install --upgrade pip
Now for Git-review just Copy&Paste
pip install git-review
I was trying to use the netjsonconfig command line utility and tried the
convert an OpenWRT tar.gz to NetJSON and print to standard output (with 4 space indentation) utility
netjsonconfig --native network --backend openwrt --method json -a indent=" "
But following error shows,
ubuntu#ip-172-31-21-48:~/netjsontest$ netjsonconfig --native backup.tar.gz --backend openwrt --method json -a indent=" "
Traceback (most recent call last):
File "/usr/local/bin/netjsonconfig", line 180, in <module>
instance = backend_class(**options)
File "/usr/local/lib/python2.7/dist-packages/netjsonconfig/backends/base/backend.py", line 47, in __init__
self.parse(native)
File "/usr/local/lib/python2.7/dist-packages/netjsonconfig/backends/base/backend.py", line 280, in parse
self.to_netjson()
File "/usr/local/lib/python2.7/dist-packages/netjsonconfig/backends/base/backend.py", line 293, in to_netjson
value = converter.to_netjson()
File "/usr/local/lib/python2.7/dist-packages/netjsonconfig/backends/base/converter.py", line 108, in to_netjson
result = self.to_netjson_loop(block, result, index + 1)
File "/usr/local/lib/python2.7/dist-packages/netjsonconfig/backends/openwrt/converters/wireless.py", line 118, in to_netjson_loop
interface = self.__get_netjson_interface(block)
File "/usr/local/lib/python2.7/dist-packages/netjsonconfig/backends/openwrt/converters/wireless.py", line 246, in __get_netjson_interface
if interface['name'] == wifi['ifname']:
KeyError: 'ifname'
`
Python version: Python 2.7.6
OS: ubuntu: 14.04
Can anyone help me to get this fixed?
Edit :
http://netjsonconfig.openwisp.org/en/stable/general/commandline_utility.html
What does network contain?
The exception you're getting looks like a bug though, you shouldn't get an exception but a failure.
Maybe is better to open an issue in https://github.com/openwisp/netjsonconfig
It seems that pylint on MacOS is not doing anything at all. Here is what I get. I did install pylint by doing pip install pylint
$ pylint tunnel.py
No config file found, using default configuration
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/pylint/lint.py", line 910, in get_ast
return MANAGER.ast_from_file(filepath, modname, source=True)
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/astroid/manager.py", line 112, in ast_from_file
return AstroidBuilder(self).file_build(filepath, modname)
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/astroid/builder.py", line 134, in file_build
module = self._data_build(data, modname, path)
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/astroid/builder.py", line 177, in _data_build
module = rebuilder.visit_module(node, modname, node_file, package)
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/astroid/rebuilder.py", line 148, in visit_module
newnode.body = [self.visit(child, newnode) for child in node.body]
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/astroid/rebuilder.py", line 148, in <listcomp>
newnode.body = [self.visit(child, newnode) for child in node.body]
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/astroid/rebuilder.py", line 161, in visit
return self._transform(visit_method(node, parent))
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/astroid/rebuilder.py", line 238, in visit_assign
newnode.value = self.visit(node.value, newnode)
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/astroid/rebuilder.py", line 161, in visit
return self._transform(visit_method(node, parent))
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/astroid/rebuilder.py", line 331, in visit_callfunc
if node.starargs is not None:
AttributeError: 'Call' object has no attribute 'starargs'
************* Module temp.test
F: 1, 0: <class 'AttributeError'>: 'Call' object has no attribute 'starargs' (astroid-error)
You're mentioning that you're using pylint 1.4.4, which is quite old and won't work with Python 3.5.
You should upgrade to the latest releases of pylint/astroid, e.g. by doing pip install -U pylint.
Here is my code:
import pyshark
capture = pyshark.LiveCapture(interface='en0')
capture.sniff()
Now here is the error:
Traceback (most recent call last):
File "<pyshell#2>", line 1, in <module>
capture.sniff()
File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/pyshark/capture/capture.py", line 109, in load_packets
self.apply_on_packets(keep_packet, timeout=timeout)
File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/pyshark/capture/capture.py", line 201, in apply_on_packets
return self.eventloop.run_until_complete(coro)
File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/trollius/base_events.py", line 350, in run_until_complete
return future.result()
File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/trollius/futures.py", line 286, in result
raise self._exception
File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/trollius/tasks.py", line 250, in _step
result = coro.throw(exc)
File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/pyshark/capture/capture.py", line 212, in packets_from_tshark
tshark_process = yield From(self._get_tshark_process(packet_count=packet_count))
File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/trollius/tasks.py", line 252, in _step
result = coro.send(value)
File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/pyshark/capture/capture.py", line 298, in _get_tshark_process
parameters = [get_tshark_path(self.tshark_path), '-l', '-n', '-T', xml_type] + self.get_parameters(packet_count=packet_count)
File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/pyshark/tshark/tshark.py", line 93, in get_tshark_path
'Search these paths: {}'.format(possible_paths)
pyshark.tshark.tshark.TSharkNotFoundException: TShark not found. Try adding its location to the configuration file. Search these paths: ['C:\\Program Files\\Wireshark\\tshark.exe', '/usr/bin/tshark', '/bin/tshark', '/usr/sbin/tshark', '/sbin/tshark']
I am running mac os 10.10.x with python 3.4.3
Installed pyshark with sudo pip3 install pyshark
Try Installing tshark that worked for me and I am on Ubuntu linux.
sudo apt-get install TShark
Blessings.
I'm having difficulty building my app using py2app. I can build it in alias mode without issue using this command:
python3.4 setup.py py2app -A
However when I try and build it using:
python3.4 setup.py py2app
I get the error message as per title of this post. From the research I've done I believe it's an issue with Pillow; however I need Pillow for this app. (Unless there's another module I can use to import images??). I've also tried cx_freeze without success.
Any help or direction much appreciated.
Full traceback as follows:
Traceback (most recent call last):
File "setup.py", line 19, in <module>
setup_requires=['py2app'],
File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/
distutils/core.py", line 148, in setup dist.run_commands()
File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/
distutils/dist.py", line 955, in run_commands self.run_command(cmd)
File"/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/
distutils/dist.py", line 974, in run_command cmd_obj.run()
File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/
site- packages/py2app/build_app.py", line 659, in run self._run()
File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/
site- packages/py2app/build_app.py", line 865, in _run self.run_normal()
File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/
site- packages/py2app/build_app.py", line 959, in
run_normal self.create_binaries(py_files, pkgdirs, extensions,loader_files)
File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/
site- packages/py2app/build_app.py", line 1214, in create_binaries
platfiles = mm.run()
File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/
site-packages/macholib/MachOStandalone.py", line 105, in run
mm.run_file(fn)
File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/
site-packages/macholib/MachOGraph.py", line 84, in run_file
self.scan_node(m)
File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/
site-packages/macholib/MachOGraph.py", line 110, in scan_node
m = self.load_file(filename, caller=node)
File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/
site-packages/macholib/MachOGraph.py", line 93, in load_file
newname = self.locate(name, loader=caller)
File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/
site-packages/macholib/MachOStandalone.py", line 23, in locate
newname = super(FilteredMachOGraph, self).locate(filename, loader)
File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/
site-packages/macholib/MachOGraph.py", line 49, in locate
loader=loader.filename)
TypeError: dyld_find() got an unexpected keyword argument 'loader'
This is a temporary solution, and it may break other things. I would recommend doing this is a virtual environment so you don't mess up your regular packages. This worked for me (virtenv is the name of my virtual environment)
Open the file /virtenv/lib/python3.4/site-packages/macholib/dyld.py and replace each instance of loader_path with loader. Now save and try again.
You can monkey-patch macholib rather than modifying it in site-packages. Place the following file to the directory containing setup_py2app.py and add import macholib_patch to the top.
macholib_patch.py:
"""
Monkey-patch macholib to fix "dyld_find() got an unexpected keyword argument 'loader'".
Add 'import macholib_patch' to the top of set_py2app.py
"""
import macholib
#print("~"*60 + "macholib verion: "+macholib.__version__)
if macholib.__version__ <= "1.7":
print("Applying macholib patch...")
import macholib.dyld
import macholib.MachOGraph
dyld_find_1_7 = macholib.dyld.dyld_find
def dyld_find(name, loader=None, **kwargs):
#print("~"*60 + "calling alternate dyld_find")
if loader is not None:
kwargs['loader_path'] = loader
return dyld_find_1_7(name, **kwargs)
macholib.MachOGraph.dyld_find = dyld_find