| Submitter | Morten Svendsen |
|---|---|
| Date | Oct. 17, 2012, 11:33 a.m. |
| Message ID | <ddbecd1163c731b4025e3690ceb00f9b226b4438.1350473427.git.morten.thunbergsvendsen@prevas.dk> |
| Download | mbox | patch |
| Permalink | /patch/192019/ |
| State | Accepted |
| Delegated to: | Esben Haabendal |
| Headers | show |
Comments
Morten Thunberg Svendsen <morten.thunbergsvendsen@prevas.dk> writes: > Prints readable error message instead of the following: > File "/src/oe-lite/meta/core/classes/core.oeclass", line 147, in runstrip > if "not stripped" not in filetype: > TypeError: argument of type 'NoneType' is not iterable > > The actual cause of this error is unknown. The magic python module do not raise > an exception when file is not readable, but returns a NoneType object 'None'. > --- > classes/core.oeclass | 4 ++++ > 1 file changed, 4 insertions(+) > > diff --git a/classes/core.oeclass b/classes/core.oeclass > index 33dfe22..9de03fc 100644 > --- a/classes/core.oeclass > +++ b/classes/core.oeclass > @@ -144,6 +144,10 @@ def runstrip(file, d): > filemagic.load() > filetype = filemagic.file(file) > > + if not filetype: > + bb.error("runstrip() unable to determine file type: %s"%(file)) > + return > + > if "not stripped" not in filetype: > print "runstrip() skip %s"%(file) > return Merged to master and 3.2 branch. /Esben
Patch
diff --git a/classes/core.oeclass b/classes/core.oeclass index 33dfe22..9de03fc 100644 --- a/classes/core.oeclass +++ b/classes/core.oeclass @@ -144,6 +144,10 @@ def runstrip(file, d): filemagic.load() filetype = filemagic.file(file) + if not filetype: + bb.error("runstrip() unable to determine file type: %s"%(file)) + return + if "not stripped" not in filetype: print "runstrip() skip %s"%(file) return
Prints readable error message instead of the following: File "/src/oe-lite/meta/core/classes/core.oeclass", line 147, in runstrip if "not stripped" not in filetype: TypeError: argument of type 'NoneType' is not iterable The actual cause of this error is unknown. The magic python module do not raise an exception when file is not readable, but returns a NoneType object 'None'. --- classes/core.oeclass | 4 ++++ 1 file changed, 4 insertions(+)