1

I have a python web2py app uploaded at PythonAnywhere. App is working fine. I want to read a csv file placed in a folder along with my app and import it into mysql table. When I try to read that CSV file, I get the error saying "[Errno 11] Resource temporarily unavailable".

I am new to python as well as PythonAnywhere and I couldn't understand this issue and can't figure it out how can I overcome this error and read a csv file successfully at server?

Note: I can run this code successfully on my local machine.

What I am doing is this:

path = '/home/user123/web2py/files/'
file_ = path+filename
print file_
with open(file_, "r") as f_obj:
    reader = csv.reader(f_obj)
    fields = reader.next()
    print fields
    self.create_new_table(tablename, fields)

Will appreciate any help in this regard.
Thanx in advance.

1
  • It's very unlikely that the code you posted raised the error. Unless it comes from somewhere inside self.create_new_table. Where in your code was the error raised? Commented Jun 8, 2015 at 11:23

1 Answer 1

2

I opened server.log file in Web tab and found out that the print statement "print fields" was causing the error .... It tried to print all the column names and at the mid of those column names, it produced this error and stopped execution. I removed such print statements which were trying to print long statements and the error was gone! It seems to be limit in print or something else similar to this, dont know exactly!

Sign up to request clarification or add additional context in comments.

2 Comments

(PythonAnywhere dev here) How weird! I've never seen a print statement do anything like that. Glad you worked it out :-)
I also didn't even think of that, thats why I sufferred from it for almost three days. That was really tragic to find out "print" statements causing that !

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.