tags:

views:

27

answers:

1

I'm trying to use this expression. And It tell me that: storbinary() takes at most 4 arguments (5 given)

ftp.storbinary("STOR " + os.path.basename(name), StringIO(content_str), "rb", 8*1024)

I can see here only 4 argument. where is hidden 5th argument. I'm confuse.

+3  A: 

You are calling a method, so the first argument is implicitly the object you're calling the method on. In other words, you don't see it, but it's there.

Looking at the ftplib documentation, it seems that your third argument, "rb", is incorrect. Your problem should be fixed if you simply remove that argument, as the third argument should be the blocksize.

Joseph Spiros
+1, correct explanation and useful tip!
Alex Martelli
Ok, I took it.... but now it tell me that: 'unicode' object has no attribute 'read'
Pol
No one can help you with that error message, we'd need to see context, and the full error message. Post another question, and include the full error message including traceback, as well as the code referenced by the error, so that it can be answered.
Joseph Spiros