On Tuesday, October 22, 2019 at 11:08:07 AM UTC+2, Davidiam wrote:
>
> Hello,
>
> I am trying to upload files via the Welcome appadmin in the Static files
> section, but the uploads are failing with "Cannot upload file <filename>"
>
> I have now traced this in Pycharm and it is failing on the call to the
> count_lines method in the admin\controllers\default.py
>
> In the debugger I see the message "AttributeError: 'dict" object has no
> attribulte 'len'"
>
> Admin\Controllers\default.py :
>
> Upload_file method calls count_lines method with the data from the file
>
>
>
> data variable contains :
>
> b"from pyspark.sql.functions import udf\r\nfrom pyspark.sql.types import
> IntegerType, StringType\r\n\r\n\r\n@udf(IntegerType())\r\ndef
> to_celsius(temp):\r\n if isinstance(temp, int):\r\n "
>
>
>
> def count_lines(data):
>
> return len([line for line in data.split('\n') if line.strip() and not
> line.startswith('#')])
>
>
>
> *Error Message :*
>
> AttributeError: 'dict" object has no attribulte 'len'
>
>
> Note: I have tried this with multiple text and binary files.
>
>
> I am working in a Winows environmet and using python 3.6
>
> Web2py : Version2.18.5-stable+timestamp.2019.04.08.04.22.03
>
>
> Did we set something up incorrectly, or is this a bug in web2py ?
>
>
> Thanks in advance,
>
> David
>
>
>
>
--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/web2py/ec57ace0-d635-4f10-a060-cf28e6baadfc%40googlegroups.com.