I was configuring my new laptop (macbook pro) and everything was fine until I wanted to try my pylint command.
Traceback (most recent call last):
File "/usr/local/bin/pylint", line 11, in <module>
load_entry_point('pylint==1.6.4', 'console_scripts', 'pylint')()
File "/usr/local/lib/python2.7/site-packages/pylint-1.6.4-py2.7.egg/pylint/__init__.py", line 13, in run_pylint
Run(sys.argv[1:])
File "/usr/local/lib/python2.7/site-packages/pylint-1.6.4-py2.7.egg/pylint/lint.py", line 1270, in __init__
'init-hook')))
File "/usr/local/lib/python2.7/site-packages/pylint-1.6.4-py2.7.egg/pylint/lint.py", line 1371, in cb_init_hook
exec(value) # pylint: disable=exec-used
File "<string>", line 1, in <module>
AttributeError: 'module' object has no attribute 'append'
From that I don't understand what's wrong with my pylint .... I tried a lot of things but as I'm not quite sure of what I've done at the end, I prefer to not list things.
Is there someone who already got it ? Someone who have an idea how to solve it?
Thanks for your help
Hi, can you show the value of init-hook from the configuration file you are using? What happen is that you have configured, somehow, init-hook with some invalid code. You can see this in your traceback through the last exec call, which happens only when init-hook is provided. Seeing its value could lead to solving this problem. My intuition is that you probably have something as in ``init-hook="import sys; sys.append(some_path)"
Thanks to PCManticore, that was that, I had a .pylintrc in my home folder that had something weard for the init-hook value. I changed that and everything is working well now.
Related
Since a few days ago, zappa deploy fails with the following error (zappa version 0.50.0):
Traceback (most recent call last):
File "/root/repo/venv/lib/python3.6/site-packages/zappa/cli.py", line 2785, in handle
sys.exit(cli.handle())
File "/root/repo/venv/lib/python3.6/site-packages/zappa/cli.py", line 510, in handle
self.dispatch_command(self.command, stage)
File "/root/repo/venv/lib/python3.6/site-packages/zappa/cli.py", line 557, in dispatch_command
self.update(self.vargs['zip'], self.vargs['no_upload'])
File "/root/repo/venv/lib/python3.6/site-packages/zappa/cli.py", line 993, in update
endpoint_configuration=self.endpoint_configuration
File "/root/repo/venv/lib/python3.6/site-packages/zappa/core.py", line 2106, in create_stack_template
self.cf_template.add_description('Automatically generated with Zappa')
AttributeError: 'Template' object has no attribute 'add_description'
Since version 3.0.0, the package troposphere removed the deprecated Template methods (see the changelog).
Breaking changes: * Python 3.6+ (Python 2.x and earlier Python 3.x support is now deprecated due to Python EOL) * Remove previously deprecated Template methods.
The above issue can be fixed by adding troposphere<3 in the requirements file.
The answer by nbeuchat might not work for everyone, an alternative solution that might help would be to change the line in venv/lib/python3.6{or 7,8, etc.}/site-packages/zappa/core.py from add_description() to set_description().
Troposphere updated add_description to set_description along with other previously deprecated template methods which is why you see the problem.
Source
I just noticed my VSCode debugger stopped working. I messed it up by accident or maybe the update changed something. Either way, I have no clue what to change to get it working.
What doesn't work is Variable list during debugging - it is always empty. Watches show as not available, calls tack only displays paused on breakpoint. Breakpoints work but stepping over lines is not available. Also, trying to evaluate a piece of code gives:
Traceback (most recent call last):
File "/home/█/.vscode/extensions/ms-python.python-2018.10.1/pythonFiles/experimental/ptvsd/ptvsd/wrapper.py", line 1339, in done
fut.result()
File "/home/█/.vscode/extensions/ms-python.python-2018.10.1/pythonFiles/experimental/ptvsd/ptvsd/futures.py", line 40, in result
reraise(self._exc_info)
File "/home/█/.vscode/extensions/ms-python.python-2018.10.1/pythonFiles/experimental/ptvsd/ptvsd/futures.py", line 149, in callback
x = next(it)
File "/home/█/.vscode/extensions/ms-python.python-2018.10.1/pythonFiles/experimental/ptvsd/ptvsd/wrapper.py", line 1957, in on_evaluate
vsc_fid = int(args['frameId'])
KeyError: 'frameId'
I suppose it is a matter of some basic config but I can't find a solution
Keeping it relatively simple. I'm trying to open a fileopenbox to select a file using easygui.
easygui.fileopenbox()
And easyGUI throws this error
'module' object has no attribute 'askopenfilename'
The Stack Trace
Traceback (most recent call last):
File "C:\Users\Administrator\Desktop\test.py", line 377, in <module>
easygui.fileopenbox()
File "C:\Python27\lib\site-packages\easygui\boxes\fileopen_box.py", line 103, in fileopenbox
func = ut.tk_FileDialog.askopenfilenames if multiple else ut.tk_FileDialog.askopenfilename
AttributeError: 'module' object has no attribute 'askopenfilename'
Whats going on here?
Nothings changed on my system at all, but it almost looks like for some reason python cant find this tkInter function.
Has anyone come across this?
Thanks!
Edit: An additional screenshot showing that the method is not found
https://gyazo.com/8b9ba0f6c23561d13babe7ce4c8b67a1
Try uninstalling your Easygui and install latest one.
Also try update Python version.
I read in the howto documentation to install Trigger, but when I test in python environment, I get the error below:
>>> from trigger.netdevices import NetDevices
>>> nd = NetDevices()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python2.7/dist-packages/trigger/netdevices/__init__.py", line 913, in __init__
with_acls=with_acls)
File "/usr/local/lib/python2.7/dist-packages/trigger/netdevices/__init__.py", line 767, in __init__
production_only=production_only, with_acls=with_acls)
File "/usr/local/lib/python2.7/dist-packages/trigger/netdevices/__init__.py", line 83, in _populate
# device_data = _munge_source_data(data_source=data_source)
File "/usr/local/lib/python2.7/dist-packages/trigger/netdevices/__init__.py", line 73, in _munge_source_data
# return loader.load_metadata(path, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/trigger/netdevices/loader.py", line 163, in load_metadata
raise RuntimeError('No data loaders succeeded. Tried: %r' % tried)
RuntimeError: No data loaders succeeded. Tried: [<trigger.netdevices.loaders.filesystem.XMLLoader object at 0x7f550a1ed350>, <trigger.netdevices.loaders.filesystem.JSONLoader object at 0x7f550a1ed210>, <trigger.netdevices.loaders.filesystem.SQLiteLoader object at 0x7f550a1ed250>, <trigger.netdevices.loaders.filesystem.CSVLoader object at 0x7f550a1ed290>, <trigger.netdevices.loaders.filesystem.RancidLoader object at 0x7f550a1ed550>]
Does anyone have some idea how to fix it?
The NetDevices constructor is apparently trying to find a "metadata source" that isn't there.
Firstly, you need to define the metadata. Second, your code should handle the exception where none is found.
I'm the lead developer of Trigger. Check out the the doc Working with NetDevices. It is probably what you were missing. We've done some work recently to improve the quality of the setup/install docs, and I hope that this is more clear now!
If you want to get started super quickly, you can feed Trigger a CSV-formatted NetDevices file, like so:
test1-abc.net.example.com,juniper
test2-abc.net.example.com,cisco
Just put that in a file, e.g. /tmp/netdevices.csv and then set the NETDEVICES_SOURCE environment variable:
export NETDEVICES_SOURCE=/tmp/netdevices.csv
And then fire up python and continue on with your examples and you should be good to go!
I found that the default of /etc/trigger/netdevices.xml wasn't listed in the setup instructions. It did indicate to copy from the trigger source folder:
cp conf/netdevices.json /etc/trigger/netdevices.json
But, I didn't see how to specify this instead of the default NETDEVICES_SOURCE on the installation page. But, as soon as I had a file that NETDEVICES_SOURCE pointed to in my /etc/trigger folder, it worked.
I recommend this to get the verifying functionality examples to work right away with minimal fuss:
cp conf/netdevices.xml /etc/trigger/netdevices.xml
Using Ubuntu 14.04 with Python 2.7.3
I'm trying to follow the tutorial at:
https://github.com/numenta/nupic/tree/master/examples/opf/clients/hotgym/prediction/one_gym
I'm right at the beginning but running the very first python script gave me an error:
Traceback (most recent call last):
File "swarm.py", line 105, in <module>
swarm(INPUT_FILE)
File "swarm.py", line 97, in swarm
modelParams = swarmForBestModelParams(SWARM_DESCRIPTION, name)
File "swarm.py", line 68, in swarmForBestModelParams
modelParams = permutations_runner.runWithConfig(
AttributeError: 'module' object has no attribute 'runWithConfig'
So I don't see anyone else complaining about this error so I'm assuming its something I'm doing (or overlooking) can you help me understand whats going on?
The contents of swarm.py are here:
https://github.com/numenta/nupic/blob/master/examples/opf/clients/hotgym/prediction/one_gym/swarm.py
I imagine you probably cloned NuPIC before you watched and ran the tutorial. The tutorial requires you to have the latest codebase. Pull the latest from master, rebuild NuPIC and try it again.
Even if you've updated the codebase and you can see the runWithConfig function, you will still need to re-run the build process as described in the README.md.