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
In summary :
I don't think the upload_file method is meant for binary data nor Windows style line returns in text files.
Is this working as designed in web2py on Windows ?
Thanks in advance,
David