EasyGui fileopenbox() Error. Has TKinter Changed? [Python] - python

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.

Related

Object Leds has no attribute animate_stop (ev3dev2 library)

First of all I want to sorry for my bad English.
I'm trying to use the ev3dev2 library and Visual Studio Code to add python code to my ev3 robot. My problem is that when I try to use the function 'animate_stop' (or 'animate_flash', 'reset', and some others) from the class 'Leds' I get an error saying that the called function isn't an attribute of the object 'Leds' but when I opened the 'led.py' file (which contains the 'Leds' class) I found all the functions that I tried to call.
I have installed ev3dev2 from github and the official SD card image file for the ev3 from its site.
The code:
#!/usr/bin/env pybricks-micropython
from ev3dev2.led import Leds
Leds().animate_stop
The error:
Traceback (most recent call last):
File "/home/robot/ttt/main.py", line 5, in <module>
AttributeError: 'Leds' object has no attribute 'animate_stop'
Try this:
#!/usr/bin/env pybricks-micropython
from ev3dev2.led import Leds
leds = Leds()
leds.all_off()

Tensorflow's API: seq2seq

I have been following https://github.com/kvfrans/twitch/blob/master/main.py tutorial to create and train a chatbot based on rnn using tensorflow. From what I understand, the tutorials was written on an older version of tensorflow, so some parts are outdated and give me an error like:
Traceback (most recent call last):
File "main.py", line 33, in <module>
outputs, last_state = tf.nn.seq2seq.rnn_decoder(inputs, initialstate, cell, loop_function=None, scope='rnnlm')
AttributeError: 'module' object has no attribute 'seq2seq'
I fixed some of them, but can't figure out what is the alternative to tf.nn.seq2seq.rnn_decoder and what should be the new module's parameters. What I currently fixed:
tf.nn.rnn_cell.BasicLSTMCell(embedsize) changed to
tf.contrib.rnn.BasicLSTMCell(embedsize)
tf.nn.rnn_cell.DropoutWrapper(lstm_cell,keep_prob) changed to tf.contrib.rnn.DropoutWrapper(lstm_cell,keep_prob)
tf.nn.rnn_cell.MultiRNNCell([lstm_cell] * numlayers) changed to
tf.contrib.rnn.MultiRNNCell([lstm_cell] * numlayers)
Can someone please help me figure out what tf.nn.seq2seq.rnn_decoder will be?
I think this is the one you need:
tf.contrib.legacy_seq2seq.rnn_decoder

Pylint AttributeError: 'module' object has no attribute 'append'

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.

cusolver library not found

I am trying to use skcuda in my python code but whenever i want to use it, it rises the following exception:
Traceback (most recent call last):
File "/home/rohola/Projects/Python/wordnetwork/s.py", line 6, in <module>
from skcuda import cusolver
File "/home/rohola/anaconda3/lib/python3.4/site- packages/skcuda/cusolver.py", line 51, in <module>
raise OSError('cusolver library not found')
OSError: cusolver library not found
i was just tried to use skcuda
from skcuda import cusolver
handle = cusolver.cusolverDnCreate()
i installed pycuda, NVIDIA CUDA Toolkit. What's wrong about my code or dependencies?
import ctypes
a = ctypes.cdll.LoadLibrary( "/usr/local/cuda-8.0/targets/x86_64-linux/lib/libcusolver.so" )
gets me
OSError: /usr/local/cuda-8.0/targets/x86_64-linux/lib/libcusolver.so: undefined symbol: GOMP_critical_end
which seems to be a yet unsolved issue according to this github thread
Though, a 7.5 version which
/usr/lib/x86_64-linux-gnu/libcusolver.so
seems to point to works well. And author's fix seems to work with it.
I finally found a solution to my problem. Firstly, i searched for libcusolver.so with
locate libcusolver.so
and then changed the following code in cusolver.py from:
_libcusolver = ctypes.cdll.LoadLibrary(_libcusolver_libname)
to:
_libcusolver = ctypes.cdll.LoadLibrary("/usr/local/cuda-7.5/targets/x86_64-linux/lib/"+_libcusolver_libname)
now the following code:
from skcuda import cusolver
handle = cusolver.cusolverDnCreate()
works without any error.
UPDATE:
If you have installed cuda8.0 or 9.0 the best way to solve the problem is to find this line in cusolver.py:
_libcusolver = ctypes.cdll.LoadLibrary(_libcusolver_libname)
and add this line before it:
ctypes.CDLL('libgomp.so.1', mode=ctypes.RTLD_GLOBAL)
You have to make sure that you already installed libgomp.

NuPIC one_hot_gym tutorial swarm attribute error

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.

Categories