python 2.7 : Tkinter ERROR: can't find package tile - python

I created GUI in Python (Python2.7) using Tkinter. I wish to have it up and running for both RHEL7.4 and RHEL5.11 versions. On REHL7.4, it works fine but on RHEL5.11, it gives the following error:
Traceback (most recent call last):
File "configure_workstation.py", line 28, in <module>
app = ConfigureWorkstation(wsObj)
File "/tmp/hnoman/v0.62/ConfigureWorkstation.py", line 90, in __init__
frame = F(self.fMenu, self)
File "/tmp/hnoman/v0.62/WorkstationInfoMenu.py", line 35, in __init__
self.generateHostnameFrame()
File "/tmp/hnoman/v0.62/WorkstationInfoMenu.py", line 50, in generateHostnameFrame
self.oLocation = ttk.OptionMenu(self.fHostname, self.location, dict[1], *dict.values())
File "/usr/local/python27/lib/python2.7/lib-tk/ttk.py", line 1591, in __init__
Menubutton.__init__(self, master, **kw)
File "/usr/local/python27/lib/python2.7/lib-tk/ttk.py", line 797, in __init__
Widget.__init__(self, master, "ttk::menubutton", kw)
File "/usr/local/python27/lib/python2.7/lib-tk/ttk.py", line 554, in __init__
_load_tile(master)
File "/usr/local/python27/lib/python2.7/lib-tk/ttk.py", line 46, in _load_tile
master.tk.eval('package require tile') # TclError may be raised here
_tkinter.TclError: can't find package tile
Can someone guide how to overcome this?

Related

torchfile.T7ReaderException

I'm working on Windows 10. I get this issue:
DATAPATH: ../data/coco/test/val_captions.t7
Traceback (most recent call last):
File "main.py", line 77, in <module>
algo.sample(datapath, cfg.STAGE)
File "D:\documenti\Monica\StackGAN-Pytorch\code\trainer.py", line 243, in sample
t_file = torchfile.load(datapath)
File "C:\Users\Utente\venv\lib\site-packages\torchfile.py", line 424, in load
return reader.read_obj()
File "C:\Users\Utente\venv\lib\site-packages\torchfile.py", line 386, in read_obj
v = self.read_obj()
File "C:\Users\Utente\venv\lib\site-packages\torchfile.py", line 386, in read_obj
v = self.read_obj()
File "C:\Users\Utente\venv\lib\site-packages\torchfile.py", line 414, in read_obj
"unknown object type / typeidx: {}".format(typeidx))
torchfile.T7ReaderException: unknown object type / typeidx: -1112529805
Can anyone help me?
I installed python 3.6.8, pytorch, torchfile, torchvision, etc., and I'm working on virtualenv.

Tkinter: "Bad label anchor specification"

I've been working with the same Python/Tkinter code for a week now, and seemingly out of nowhere I am getting the error "Bad label specification":
Traceback (most recent call last):
File "C:/Users/shapirju/Desktop/NumericalAnalysis-Project2/gui.py", line 1188, in <module>
gui = App()
File "C:/Users/shapirju/Desktop/NumericalAnalysis-Project2/gui.py", line 62, in __init__
self.createWidgets()
File "C:/Users/shapirju/Desktop/NumericalAnalysis-Project2/gui.py", line 70, in createWidgets
self.interpLabelframe = LabelFrame(self.root, text = "Interpolation", labelanchor=N)
File "C:\Program Files\Python27\lib\lib-tk\ttk.py", line 776, in __init__
Widget.__init__(self, master, "ttk::labelframe", kw)
File "C:\Program Files\Python27\lib\lib-tk\ttk.py", line 555, in __init__
Tkinter.Widget.__init__(self, master, widgetname, kw=kw)
File "C:\Program Files\Python27\lib\lib-tk\Tkinter.py", line 2096, in __init__
(widgetName, self._w) + extra + self._options(cnf))
_tkinter.TclError: Bad label anchor specification 443664640LN
It is caused by the line self.interpLabelframe = LabelFrame(self.root, text = "Interpolation", labelanchor=N)
As this worked a few hours ago, maybe this is an environmental issue? I cannot find anything about this issue on Google.
Changing it to self.interpLabelframe = LabelFrame(self.root, text = "Interpolation", labelanchor='n') fixes the issue.
According to the source code for LabelFrame, the label anchors are defined as strings 'n', 'we', etc.

vboxapi COM API not working

I have the virtualbox 5.0.10 Python sdk in my source root, but when I run my code the program will fail:
Traceback (most recent call last):
File "C:/Users/xiao/.PyCharm50/config/scratches/scratch", line 2, in <module>
mgr=vboxapi.VirtualBoxManager()
File "C:\Users\xiao\Desktop\test\vboxapi\__init__.py", line 1018, in __init__
self.platform = PlatformMSCOM(dPlatformParams)
File "C:\Users\xiao\Desktop\test\vboxapi\__init__.py", line 513, in __init__
win32com.client.gencache.EnsureDispatch('VirtualBox.Session')
File "C:\Python27\lib\site-packages\win32com\client\gencache.py", line 540, in EnsureDispatch
disp_class = CLSIDToClass.GetClass(str(disp_clsid))
File "C:\Python27\lib\site-packages\win32com\client\CLSIDToClass.py", line 46, in GetClass
return mapCLSIDToClass[clsid]
KeyError: '{7844AA05-B02E-4CDD-A04F-ADE4A762E6B7}'
Here is my code: (really simple, right?)
import vboxapi
mgr=vboxapi.VirtualBoxManager()
This program is buggy under Python 2.7.6, but runabble under Python 3.4.0.
Why? How can I fix that?

Python: Message error when using bgpic() from turtle module

I'm trying to change the background image in a turtle window.
The code reads simply as this:
import turtle
turtle.bgpic("france53.gif")
The turtle window shows up blank and I get the following error message:
Traceback (most recent call last):
File "<ipython-input-25-45373f8f3ea2>", line 1, in <module>
bgpic("france53.gif")
File "<string>", line 1, in bgpic
File "/Users/danielcharrier/anaconda/lib/python3.4/turtle.py", line 1482, in bgpic
self._setbgpic(self._bgpic, self._bgpics[picname])
File "/Users/danielcharrier/anaconda/lib/python3.4/turtle.py", line 738, in _setbgpic
self.cv.itemconfig(item, image=image)
File "<string>", line 1, in itemconfig
File "/Users/danielcharrier/anaconda/lib/python3.4/tkinter/__init__.py", line 2416, in itemconfigure
return self._configure(('itemconfigure', tagOrId), cnf, kw)
File "/Users/danielcharrier/anaconda/lib/python3.4/tkinter/__init__.py", line 1310, in _configure
self.tk.call(_flatten((self._w, cmd)) + self._options(cnf))
TclError: image "pyimage12" doesn't exist
The file "france53.gif" is in the working directory. What should I do to make it work?
I'm using the Anaconda distribution for Mac OS X.
Thanks!

Error import pylab in python 2.5

I tried to run this simple program on python 2.5 and get the following error, I am not sure what is going on.
Code:
import pylab
pylab.figure(1) # make figure 1 the current figure
pylab.plot([1,2,3,4], [1,7,3,5]) # draw on figure 1
pylab.show() # show figure on screen
Error:
Traceback (most recent call last):
File "/Users/sebastiancarrasco/Desktop/Courses/6.00.2x/Week1/plotting-seg1.py", line 3, in <module>
pylab.figure(1) # make figure 1 the current figure
File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/matplotlib/pyplot.py", line 270, in figure
**kwargs)
File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/matplotlib/backends/backend_tkagg.py", line 85, in new_figure_manager
figManager = FigureManagerTkAgg(canvas, num, window)
File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/matplotlib/backends/backend_tkagg.py", line 403, in __init__
self.toolbar = NavigationToolbar2TkAgg( canvas, self.window )
File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/matplotlib/backends/backend_tkagg.py", line 670, in __init__
NavigationToolbar2.__init__(self, canvas)
File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/matplotlib/backend_bases.py", line 2273, in __init__
self._init_toolbar()
File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/matplotlib/backends/backend_tkagg.py", line 719, in _init_toolbar
command=self.home)
File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/matplotlib/backends/backend_tkagg.py", line 702, in _Button
im = Tk.PhotoImage(master=self, file=file)
File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/lib-tk/Tkinter.py", line 3294, in __init__
Image.__init__(self, 'photo', name, cnf, master, **kw)
File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/lib-tk/Tkinter.py", line 3250, in __init__
self.tk.call(('image', 'create', imgtype, name,) + options)
TclError: couldn't open "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/matplotlib/mpl-data/images/home.ppm": permission denied
For anyone else who runs into this problem and comes across this page: I eventually found the answer here. Long story short: some problem with the installer messes up the permissions for all the files in the "images" folder. All you have to do is change the permissions to give yourself read privileges.

Categories