Error Value: len() of unsized object at SQL method
Hello! I have an SQL select. If it gives no result, I get this error message Error Type: TypeError Error Value: len() of unsized object How can I manage it? I tried this: <dtml-in ZSQLSelect> foo, bar..... <dtml-else> no result </dtml-in> but still get the error. Thanks: Lajos Kerekes
There's nothing wrong with the DTML. Paste the traceback in and we'll help you. And decide which works. Does that ZSQL method work independent of how you use it? Does the DTML work when looping on something else than that object? Cheers, Peter
Hello!
I have an SQL select. If it gives no result, I get this error message Error Type: TypeError Error Value: len() of unsized object
How can I manage it? I tried this: <dtml-in ZSQLSelect> foo, bar..... <dtml-else> no result </dtml-in>
but still get the error.
Thanks:
Lajos Kerekes
_______________________________________________ Zope maillist - Zope@zope.org http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
Here is the traceback: Traceback (innermost last): File /usr/local/zope/Zope-2.3.3-linux2-x86/lib/python/ZPublisher/Publish.py, line 223, in publish_module File /usr/local/zope/Zope-2.3.3-linux2-x86/lib/python/ZPublisher/Publish.py, line 187, in publish File /usr/local/zope/Zope-2.3.3-linux2-x86/lib/python/Zope/__init__.py, line 221, in zpublisher_exception_hook (Object: monitorToolForm) File /usr/local/zope/Zope-2.3.3-linux2-x86/lib/python/ZPublisher/Publish.py, line 171, in publish File /usr/local/zope/Zope-2.3.3-linux2-x86/lib/python/ZPublisher/mapply.py, line 160, in mapply (Object: showTrState) File /usr/local/zope/Zope-2.3.3-linux2-x86/lib/python/ZPublisher/Publish.py, line 112, in call_object (Object: showTrState) File /usr/local/zope/Zope-2.3.3-linux2-x86/lib/python/OFS/DTMLMethod.py, line 189, in __call__ (Object: showTrState) File /usr/local/zope/Zope-2.3.3-linux2-x86/lib/python/DocumentTemplate/DT_String.py, line 540, in __call__ (Object: showTrState) File /usr/local/zope/Zope-2.3.3-linux2-x86/lib/python/DocumentTemplate/DT_Let.py, line 149, in render (Object: stateofscript="manipulateZSQL(this())") File /usr/local/zope/Zope-2.3.3-linux2-x86/lib/python/DocumentTemplate/DT_In.py, line 652, in renderwob (Object: manipulatedSelect) File /usr/local/zope/Zope-2.3.3-linux2-x86/lib/python/Shared/DC/ZRDB/DA.py, line 489, in __call__ (Object: manipulatedSelect) File /usr/local/zope/Zope-2.3.3-linux2-x86/lib/python/Products/ZOracleDA/db.py, line 221, in query File /usr/local/zope/Zope-2.3.3-linux2-x86/lib/python/Products/ZOracleDA/db.py, line 229, in _lobConvert TypeError: (see above) The DTML works if the query has result. But if hasn't, I get this error. I use ZOracleDA 2.2.0-b1, and Oracle 8i under Linux. Lajos Peter Bengtsson wrote:
There's nothing wrong with the DTML.
Paste the traceback in and we'll help you. And decide which works. Does that ZSQL method work independent of how you use it? Does the DTML work when looping on something else than that object?
Cheers, Peter
Hello!
I have an SQL select. If it gives no result, I get this error message Error Type: TypeError Error Value: len() of unsized object
How can I manage it? I tried this: <dtml-in ZSQLSelect> foo, bar..... <dtml-else> no result </dtml-in>
but still get the error.
Thanks:
Lajos Kerekes
_______________________________________________ Zope maillist - Zope@zope.org http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
Use <dtml-try>....</dtml-except>. If you get no result, there is no sequence to loop over with dtml-in, that's why you get an error. Still, I don't get this problem using ZODBC and Zope 2.3.3 on Windows. If there is no data, dtml-in simply has no rows to loop over, but it doesn't give an error. So the returned data object includes an empty sequence, while in your case there is no sequence. Maybe it depends on the particular database adapter you are using. Cheers, Tom P [Kerekes Lajos]
I have an SQL select. If it gives no result, I get this error message Error Type: TypeError Error Value: len() of unsized object
How can I manage it? I tried this: <dtml-in ZSQLSelect> foo, bar..... <dtml-else> no result </dtml-in>
but still get the error.
Kerekes Lajos writes:
I have an SQL select. If it gives no result, I get this error message Error Type: TypeError Error Value: len() of unsized object
How can I manage it? I tried this: <dtml-in ZSQLSelect> foo, bar..... <dtml-else> no result </dtml-in>
but still get the error. You got a traceback!
It helps you to narrow down the location of the problem. Look at it and if necessary post it such that we can look at it (to help you). Dieter
participants (4)
-
Dieter Maurer -
Kerekes Lajos -
Peter Bengtsson -
Thomas B. Passin