Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #53787 > unrolled thread
| Started by | stas poritskiy <stascrash@gmail.com> |
|---|---|
| First post | 2013-09-06 08:00 -0700 |
| Last post | 2013-09-06 12:28 -0700 |
| Articles | 6 — 4 participants |
Back to article view | Back to comp.lang.python
how to trouble shoot - RuntimeError: Open Failed stas poritskiy <stascrash@gmail.com> - 2013-09-06 08:00 -0700
Re: how to trouble shoot - RuntimeError: Open Failed Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-09-06 15:27 +0000
Re: how to trouble shoot - RuntimeError: Open Failed Neil Cerutti <neilc@norwich.edu> - 2013-09-06 15:39 +0000
Re: how to trouble shoot - RuntimeError: Open Failed stas poritskiy <stascrash@gmail.com> - 2013-09-06 10:05 -0700
Re: how to trouble shoot - RuntimeError: Open Failed Terry Reedy <tjreedy@udel.edu> - 2013-09-06 14:49 -0400
Re: how to trouble shoot - RuntimeError: Open Failed stas poritskiy <stascrash@gmail.com> - 2013-09-06 12:28 -0700
| From | stas poritskiy <stascrash@gmail.com> |
|---|---|
| Date | 2013-09-06 08:00 -0700 |
| Subject | how to trouble shoot - RuntimeError: Open Failed |
| Message-ID | <8e84343f-1eff-4ed4-bfa7-aaf5755b5114@googlegroups.com> |
hey guys, I am working on application. App is processing a list of files in folders. Folders act as a NEW-LOOP. so if all files in one folder had been worked on, file is then saved and next folder is picked up. it works fine only if i have a SINGLE folder, however, when another folder is there, i get this RuntimeError: Open Failed. I checked if those could be the files by leaving only single (another folder), however all was fine. Questions - How can i trouble shoot what is causing the problem? i don't know where to begin. Thanks!
[toc] | [next] | [standalone]
| From | Steven D'Aprano <steve+comp.lang.python@pearwood.info> |
|---|---|
| Date | 2013-09-06 15:27 +0000 |
| Message-ID | <5229f452$0$29988$c3e8da3$5496439d@news.astraweb.com> |
| In reply to | #53787 |
On Fri, 06 Sep 2013 08:00:13 -0700, stas poritskiy wrote:
> hey guys,
> I am working on application. App is processing a list of files in
> folders. Folders act as a NEW-LOOP. so if all files in one folder had
> been worked on, file is then saved and next folder is picked up. it
> works fine only if i have a SINGLE folder, however, when another folder
> is there, i get this RuntimeError: Open Failed. I checked if those could
> be the files by leaving only single (another folder), however all was
> fine. Questions - How can i trouble shoot what is causing the problem? i
> don't know where to begin.
You should ALWAYS begin with the entire traceback, not just the last
line. Everything starting with:
Traceback (most recent call last):
and ending with the last line, which in your case will be something like
"RuntimeError: Open failed". The most important part is that the
traceback will actually show you the line that fails.
Secondly, whose code is this? I assume it is code you have written. In
that case, do you have something like this in your code?
try:
blah blah blah # whatever, doesn't matter what this is
except:
raise RuntimeError("Open failed")
If so, take it out immediately! All you are doing is catching a *useful*
exception that Python generates, and replacing it with an utterly useless
exception that does nothing but hide the true cause of the problem and
make debugging much more difficult.
That will do to start. If you still need help, please copy and paste the
entire traceback. Also, demonstrating a *minimal* amount of code that
causes this error will help. Although this is written for Java
programmers, the same principles apply to Python code too:
http://sscce.org/
--
Steven
[toc] | [prev] | [next] | [standalone]
| From | Neil Cerutti <neilc@norwich.edu> |
|---|---|
| Date | 2013-09-06 15:39 +0000 |
| Message-ID | <b8ub8oFelgnU1@mid.individual.net> |
| In reply to | #53787 |
On 2013-09-06, stas poritskiy <stascrash@gmail.com> wrote: > I am working on application. App is processing a list of files > in folders. Folders act as a NEW-LOOP. so if all files in one > folder had been worked on, file is then saved and next folder > is picked up. it works fine only if i have a SINGLE folder, > however, when another folder is there, i get this RuntimeError: > Open Failed. I checked if those could be the files by leaving > only single (another folder), however all was fine. Questions - > How can i trouble shoot what is causing the problem? i don't > know where to begin. We can help better if you show some of your code; a minimal cut-down version that exhibits the error is ideal. Are you literally getting a RuntimeError? That would be weird. -- Neil Cerutti
[toc] | [prev] | [next] | [standalone]
| From | stas poritskiy <stascrash@gmail.com> |
|---|---|
| Date | 2013-09-06 10:05 -0700 |
| Message-ID | <3d5be177-cda2-4612-9117-a2ed9a448f6d@googlegroups.com> |
| In reply to | #53790 |
The code in development is mine, and i am using the API provided by a main developer.
At the moment, i am not using any try/except functionality.
here is the full Exception output:
[CODE]
Exception in Tkinter callback
Traceback (most recent call last):
File "C:\Python27\32bit\lib\lib-tk\Tkinter.py", line 1470, in __call__
return self.func(*args)
File "E:\sporitskiy\HON\Project\scene7\s7operator\gui.py", line 59, in <lambda>
cmd1 = lambda: vntProcessor.colData(folders.path, folders.subFolders)
File "E:\sporitskiy\HON\Project\scene7\s7operator\vntProcessor.py", line 184, in colData
setVars()
File "E:\sporitskiy\HON\Project\scene7\s7operator\vntProcessor.py", line 79, in __call__
self.batchFiles()
File "E:\sporitskiy\HON\Project\scene7\s7operator\vntProcessor.py", line 55, in batchFiles
self.vntConnect.createVNTobjects(self.vntObjMgroup.keyList, self.vntLtoF.keyValList, self.vntObjFile.keyList, myPath)
File "E:\sporitskiy\HON\Project\scene7\s7operator\vntProcessor.py", line 113, in createVNTobjects
self.createImage(groupName, layerName, fileName, imagePath, self.vntGroups)
File "E:\sporitskiy\HON\Project\scene7\s7operator\vntProcessor.py", line 137, in createImage
img = open_image(imageFile)
File "<string>", line 2, in open_image
File "C:\Python27\32bit\lib\site-packages\s7vampy\arg_validator.py", line 213, in __call__
return func(*args, **keywords)
File "C:\Python27\32bit\lib\site-packages\s7vampy\image.py", line 181, in open_image
return Image(_S7VAM_IMAGE.Open(filename))
RuntimeError: Open Failed: 'C:/Users/sporitskiy/Desktop/Practice/HIWM2MSB/hiwm2mpa_upholstery_esq_leather_ro_12_0001.tif'
[/CODE]
-- Just a few words on what this all does --
Structure: 3 modules
Module 1 - dataPreparation.py -responsible for string processing - made of several classes and methods that receive PATH to directory, collect all files in a LIST, after that for each file based on type of file name it sorts it out to appropriate categories that can be accessed through class instances.
Module 2 - gui.py - Responsible for GUI. It crates a simple GUi-layout that offer BROWSE button (to get the PATH), QUIT button to exit application, LISTBOX that lists subfolders from the PATH, and BATCH button that must execute the main processor.
Module 3 - vntProcessor.py - Responsible for processing of collected data. This module is based of an API of another application. It receives the values from the BATCH-button and invokes specific methods based on sorting that was performed using MODULE 1.
My approach:
i created an instance of GUI and call it to start interface ( have a window open) in the interface, i browse for specific folder, so my PATH variable is set. my list box is populated with subfolders.(using Tkinter for gui)
my next step should be to press the BATCH folder and forward all of the values (PATH and ARRAY of SUBFOLDERS) to my Module 3 (processor).
and as soon as my script tries to open NEXT FOLDER is when i get this RuntimeError, but if i leave the same folder by itself - everything is fine.
If by looking at the Exception Log i posted, you could tell me what portion of the code i should show here - it would be very helpful. thanks!
On Friday, September 6, 2013 10:39:04 AM UTC-5, Neil Cerutti wrote:
> On 2013-09-06, stas poritskiy <stascrash@gmail.com> wrote:
>
> > I am working on application. App is processing a list of files
>
> > in folders. Folders act as a NEW-LOOP. so if all files in one
>
> > folder had been worked on, file is then saved and next folder
>
> > is picked up. it works fine only if i have a SINGLE folder,
>
> > however, when another folder is there, i get this RuntimeError:
>
> > Open Failed. I checked if those could be the files by leaving
>
> > only single (another folder), however all was fine. Questions -
>
> > How can i trouble shoot what is causing the problem? i don't
>
> > know where to begin.
>
>
>
> We can help better if you show some of your code; a minimal
>
> cut-down version that exhibits the error is ideal.
>
>
>
> Are you literally getting a RuntimeError? That would be weird.
>
>
>
> --
>
> Neil Cerutti
[toc] | [prev] | [next] | [standalone]
| From | Terry Reedy <tjreedy@udel.edu> |
|---|---|
| Date | 2013-09-06 14:49 -0400 |
| Message-ID | <mailman.132.1378493422.5461.python-list@python.org> |
| In reply to | #53797 |
On 9/6/2013 1:05 PM, stas poritskiy wrote: > The code in development is mine, and i am using the API provided by a main developer. > > At the moment, i am not using any try/except functionality. > > here is the full Exception output: > [CODE] > Exception in Tkinter callback > Traceback (most recent call last): > File "C:\Python27\32bit\lib\lib-tk\Tkinter.py", line 1470, in __call__ > return self.func(*args) > File "E:\sporitskiy\HON\Project\scene7\s7operator\gui.py", line 59, in <lambda> > cmd1 = lambda: vntProcessor.colData(folders.path, folders.subFolders) > File "E:\sporitskiy\HON\Project\scene7\s7operator\vntProcessor.py", line 184, in colData > setVars() > File "E:\sporitskiy\HON\Project\scene7\s7operator\vntProcessor.py", line 79, in __call__ > self.batchFiles() > File "E:\sporitskiy\HON\Project\scene7\s7operator\vntProcessor.py", line 55, in batchFiles > self.vntConnect.createVNTobjects(self.vntObjMgroup.keyList, self.vntLtoF.keyValList, self.vntObjFile.keyList, myPath) > File "E:\sporitskiy\HON\Project\scene7\s7operator\vntProcessor.py", line 113, in createVNTobjects > self.createImage(groupName, layerName, fileName, imagePath, self.vntGroups) > File "E:\sporitskiy\HON\Project\scene7\s7operator\vntProcessor.py", line 137, in createImage > img = open_image(imageFile) > File "<string>", line 2, in open_image > File "C:\Python27\32bit\lib\site-packages\s7vampy\arg_validator.py", line 213, in __call__ > return func(*args, **keywords) > File "C:\Python27\32bit\lib\site-packages\s7vampy\image.py", line 181, in open_image > return Image(_S7VAM_IMAGE.Open(filename)) > RuntimeError: Open Failed: 'C:/Users/sporitskiy/Desktop/Practice/HIWM2MSB/hiwm2mpa_upholstery_esq_leather_ro_12_0001.tif' We were confused because the failed open should be an IOError. If Image is indeed converting such to RuntimeError, it should not. It should just let the original error bubble up. It is possibly tossing information in the process. The first thing I would do is to look at the code around that line in image.py and remove the exception replacement if there is one. -- Terry Jan Reedy
[toc] | [prev] | [next] | [standalone]
| From | stas poritskiy <stascrash@gmail.com> |
|---|---|
| Date | 2013-09-06 12:28 -0700 |
| Message-ID | <1fcd9616-adeb-4184-aeca-92038841fb3b@googlegroups.com> |
| In reply to | #53803 |
Guys, as i was writing a very detailed message with code samples, following the guide that Steven linked, i found the problem. a pretty lame one, actually. in my class that was processing the images, i created an object instance, via __INIT__ , self.data = attributes() but i was iterating through list of folders, so object was filled with the correct data, but it was never re-initialized for the new one. i move my objects into a function, and called the function on each loop-start, so objects are re-created and re-filled with the data. Terry, yeah, your confusion was right, and pointing out that i was supposed to get IOError. that lead me to inspect code again and again :) anyways, thanks and sorry for the mess ) On Friday, September 6, 2013 1:49:57 PM UTC-5, Terry Reedy wrote: > On 9/6/2013 1:05 PM, stas poritskiy wrote: > > > The code in development is mine, and i am using the API provided by a main developer. > > > > > > At the moment, i am not using any try/except functionality. > > > > > > here is the full Exception output: > > > [CODE] > > > Exception in Tkinter callback > > > Traceback (most recent call last): > > > File "C:\Python27\32bit\lib\lib-tk\Tkinter.py", line 1470, in __call__ > > > return self.func(*args) > > > File "E:\sporitskiy\HON\Project\scene7\s7operator\gui.py", line 59, in <lambda> > > > cmd1 = lambda: vntProcessor.colData(folders.path, folders.subFolders) > > > File "E:\sporitskiy\HON\Project\scene7\s7operator\vntProcessor.py", line 184, in colData > > > setVars() > > > File "E:\sporitskiy\HON\Project\scene7\s7operator\vntProcessor.py", line 79, in __call__ > > > self.batchFiles() > > > File "E:\sporitskiy\HON\Project\scene7\s7operator\vntProcessor.py", line 55, in batchFiles > > > self.vntConnect.createVNTobjects(self.vntObjMgroup.keyList, self.vntLtoF.keyValList, self.vntObjFile.keyList, myPath) > > > File "E:\sporitskiy\HON\Project\scene7\s7operator\vntProcessor.py", line 113, in createVNTobjects > > > self.createImage(groupName, layerName, fileName, imagePath, self.vntGroups) > > > File "E:\sporitskiy\HON\Project\scene7\s7operator\vntProcessor.py", line 137, in createImage > > > img = open_image(imageFile) > > > File "<string>", line 2, in open_image > > > File "C:\Python27\32bit\lib\site-packages\s7vampy\arg_validator.py", line 213, in __call__ > > > return func(*args, **keywords) > > > File "C:\Python27\32bit\lib\site-packages\s7vampy\image.py", line 181, in open_image > > > return Image(_S7VAM_IMAGE.Open(filename)) > > > RuntimeError: Open Failed: 'C:/Users/sporitskiy/Desktop/Practice/HIWM2MSB/hiwm2mpa_upholstery_esq_leather_ro_12_0001.tif' > > > > We were confused because the failed open should be an IOError. If Image > > is indeed converting such to RuntimeError, it should not. It should just > > let the original error bubble up. It is possibly tossing information in > > the process. The first thing I would do is to look at the code around > > that line in image.py and remove the exception replacement if there is one. > > > > -- > > Terry Jan Reedy
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.python
csiph-web