tkinter.TclError: invalid command name ".52674064 - user-interface

I am trying to run a Tkinter GUI on Python 3.x and When I use the .get command to get the number off a scale, this error pops up
Exception in Tkinter callback
Traceback (most recent call last):
File "C:\Python34\lib\tkinter\__init__.py", line 1482, in __call__
return self.func(*args)
File "C:\Users\Danny\Downloads\Space RPG. Alpha 0.2 (2) (1).py", line 39, in close
print (w1.get(), w2.get())
File "C:\Python34\lib\tkinter\__init__.py", line 2840, in get
value = self.tk.call(self._w, 'get')
_tkinter.TclError: invalid command name ".52674064"
What is happening?

That usually means that you're trying to call a method on a widget that has been destroyed. The string .52674064 is the internal name of a specific widget.
This can easily happen if you call a function via a binding or via after, if the widget is destroyed before the binding or after call has been triggered.

Related

Anyone familiar with KeyError: 'v5' while using gekko

Anyone familiar with this error?
Traceback (most recent call last):
File "C:/Users/Geebug/Documents/ParameterEstimationGekko_v6.py", line 104, in <module>
m.solve()
File "C:\Users\Geebug\AppData\Local\Programs\Python\Python39\lib\site-packages\gekko\gekko.py", line 2227, in solve
self.load_JSON()
File "C:\Users\Geebug\AppData\Local\Programs\Python\Python39\lib\site-packages\gekko\gk_post_solve.py", line 70, in load_JSON
vp.__dict__[o] = data[vp.name][o]
KeyError: 'v5'
I am trying to solve a (parameter estimation) optimization problem in a loop using Gekko, such that the values of the parameter changes with every iteration and solves. The problem solve only the first two iterations and produces the above error message after the second iteration.
The KeyError is likely due a Gekko variable that is redefined as another Gekko variable so it no longer exists as an output. The error happens when the solution is returned to Python and loaded back into x.value after a solution is found.

'Error compiling Cython file error' from one day to another

I use a lot of special characters from Hun language, and there were no problems previously. Now they all give errors when running the whole script (F9). It still runs perfect when running locally (select + F5).
Fúú='bar'
Traceback:
C:\Users\my name\.ipython\cython\_cython_magic_21a3824690cdb52a9fe6a3fa1c63ee73.pyx:1:1: Unrecognized character
Traceback (most recent call last):
File "<ipython-input-6-dcfab52d0ff4>", line 1, in <module>
runfile('E:/Anyagok/Programozas/Python/projekts/elo/mindennap/untitled0.pyx', wdir='E:/Anyagok/Programozas/Python/projekts/elo/mindennap')
File "E:\Download\PROGIK\ANACONDA\lib\site-packages\spyder\utils\site\sitecustomize.py", line 703, in runfile
ipython_shell.run_cell_magic('cython', '', f.read())
File "E:\Download\PROGIK\ANACONDA\lib\site-packages\IPython\core\interactiveshell.py", line 2131, in run_cell_magic
result = fn(magic_arg_s, cell)
File "<decorator-gen-130>", line 2, in cython
File "E:\Download\PROGIK\ANACONDA\lib\site-packages\IPython\core\magic.py", line 187, in <lambda>
call = lambda f, *a, **k: f(*a, **k)
File "E:\Download\PROGIK\ANACONDA\lib\site-packages\Cython\Build\IpythonMagic.py", line 321, in cython
assert len(extensions) == 1
TypeError: object of type 'NoneType' has no len()
If I change to e.g.
Fuu='bar'
it works great. Why the sudden change of heart?
EDIT:
Have been messing around with FFMPEG and LIBAV yesterday, because wanted to download and convert Youtube videos to mp3. But I'm pretty sure I ran scripts with these characters succesfully after it.

Behave in parallel

I try to run behave tests in parallel. For this I use behave-parallel lib and demo project https://github.com/vishalm/behave_parallel_demo. But OS is Windows 10. After steps from Read_me file. I am getting next Tracebacks
(behave_parallel_demo-master) D:\Python_projects\behave_parallel_demo-master>behave --processes 5 --parallel-element feature
INFO: 0 scenario(s) and 3 feature(s) queued for consideration by 5 workers. Some may be skipped if the -t option was given...
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "c:\python27\Lib\multiprocessing\forking.py", line 381, in main
self = load(from_parent)
File "c:\python27\Lib\pickle.py", line 1384, in load
return Unpickler(file).load()
File "c:\python27\Lib\pickle.py", line 864, in load
dispatch[key](self)
File "c:\python27\Lib\pickle.py", line 1089, in load_newobj
obj = cls.__new__(cls, *args)
TypeError: __new__() takes exactly 3 arguments (2 given)
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\Andriy_Petrenko\Envs\behave_parallel_demo-master\Scripts\behave.exe\__main__.py", line 9, in <module>
File "c:\users\andriy_petrenko\envs\behave_parallel_demo-master\lib\site-packages\behave\__main__.py", line 111, in main
failed = runner.run()
File "c:\users\andriy_petrenko\envs\behave_parallel_demo-master\lib\site-packages\behave\runner.py", line 561, in run
return self.run_with_paths()
File "c:\users\andriy_petrenko\envs\behave_parallel_demo-master\lib\site-packages\behave\runner.py", line 583, in run_with_paths
return self.run_multiproc()
File "c:\users\andriy_petrenko\envs\behave_parallel_demo-master\lib\site-packages\behave\runner.py", line 690, in run_multiproc
p.start()
File "c:\python27\Lib\multiprocessing\process.py", line 130, in start
self._popen = Popen(self)
File "c:\python27\Lib\multiprocessing\forking.py", line 280, in __init__
to_child.close()
IOError: [Errno 22] Invalid argument
What I do wrong or is this OS problem? It looks like that 5 workers were up but 1st problem is that TypeError: __new__() takes exactly 3 arguments (2 given) and 2nd IOError: [Errno 22] Invalid argument
I am not familiar with Behave so not sure whether you are passing the command line correctly but this error means that one of the method is expecting more arguments than you have provided. In this case, it's during creation of cls instance:
File "c:\python27\Lib\pickle.py", line 1089, in load_newobj
obj = cls.__new__(cls, *args)
This looks like some internal class instance so you do not control it directly so make sure you pass enough and correct arguments at command line.
Update your Behave package. it will work.
We have been trying for a long time to implement parallel test executions with behave (which is an amazing framework). Finally, we created our own wrapper on top of Behave, called BehaveX, that not only allow us to execute tests in parallel, but also comes with great reports and some additional features:
https://github.com/hrcorval/behavex
As BehaveX is implemented over the Behave framework, with this wrapper you should be able to replace the "behave" executable by "behavex", and run the tests in parallel using the following commands:
behavex -t #TAG --parallel-processes 4 --parallel-scheme scenario
behavex -t #TAG --parallel-processes 3 --parallel-scheme feature

sublimeREPL for python not showing complete Traceback

I'm trying to run my python code using sublimeREPL's "Python - RUN current file" command
It works fine if my program has no problems, but when it does, it doesn't show the complete Traceback (I don't get to see the "Repl Closed" message), and the output its not even consistent. Below two runs of the exactly same file (not posting images because stackoverflow doesn't allows me to because I'm new):
First Run:
------- Ford Fulkerson -------
Traceback (most recent call last):
File "Ford-Fulkerson.py", line 282, in <module>
D = FordFulkersonGeneral(G, ['A'], ['E'], None, restricciones)
File "Ford-Fulkerson.py", line 71, in FordFulk|
Second Run:
------- Ford Fulkerson -------
Traceback (most recent call last):
File "Ford-Fulkerson.py", line 282, in <module>
D = FordFulkersonGeneral(G, ['A'], ['E'
I was using the Anaconda's (64 bit) python distribution. Then I changed to a regular python (32 bit) install (made sure the window's path was all right) and even there its not working.
If I run my code from window's terminal I get the full Traceback (the actual error is not important, I know how to fix it):
------- Ford Fulkerson -------
Traceback (most recent call last):
File "Ford-Fulkerson.py", line 282, in <module>
D = FordFulkersonGeneral(G, ['A'], ['E'], None, restricciones)
File "Ford-Fulkerson.py", line 71, in FordFulkersonGeneral
G.deleteNode(v)
File "C:\Users\myusername\Documents\Learning\Anßlisis de Re
des\Ford-Fulkerson\mvr_graph.py", line 196, in deleteNode
self.nodes[node].delete(n)
AttributeError: 'dict' object has no attribute 'delete'
Edit:
I've found the answer by posting this question. The problem was in the path of the file - it contains an accent in the word "Análisis". I changed that and know its working.
It used to work when I had my OS language set to spanish. I set my new installation to english and now it was giving me trouble. I really didn't expected that, shame on you Windows x(.
I don't really know the protocol, I will just leave this question here in case anyone is going through this obscure thing.
I've found the answer by posting this question. The problem was in the path of the file - it contains an accent in the word "Análisis". I changed that and know its working.
It used to work when I had my OS language set to spanish. I set my new installation to english and now it was giving me troubles. I really didn't expected that, shame on you Windows x(.

Traceback/NameError exception using SublimeText 2 with Ruby

This code form RubyMonk works in RubyMonk:
class Calculator
def add(a, b)
a + b
end
def subtract(a, b)
a - b
end
end
I copied it to Sublime Text 2, set the build system to Ruby, then I saved it. When I type in the console something like add(1, 2), I get the following exception:
Traceback (most recent call last):
File "<string>", line 1, in <module>
NameError: name 'add' is not defined
I couldn't find a solution to this. I tried reinstalling Sublime Text 2, tried the beta of ST3, tried other code which I know to be good (same error), etc., and nothing is working. Any ideas?
EDIT: On the suggestion of another user, I tried:
Calculator.new.add(1, 2)
which returned:
Traceback (most recent call last):
File "<string>", line 1, in <module>
NameError: name 'Calculator' is not defined
Sublime Text 2 console is python console, not ruby.
Additionally your ruby code is incorrect.
I have the sensation that you're calling the method add(1,2) for no Object at all. What I mean is, in this case, that you're not telling the Calculator to add, but just to the thin air... which does not know how to add!
Try doing th following:
Calculator.new.add(1,2)
And you'll be asking an instance of the Calculator to add.
Tell me if you have any doubts or if I'm completely mistaken!
EDIT: As stated by texasbruce, ST2 console is Python. Therefore, the solution is the following:
Add puts Calculator.new.add(1,2) in the code and hit Ctrl+B to launch Ruby.

Resources