We were unable to load Disqus. If you are a moderator please see our troubleshooting guide.
This has been working great, but recently I am getting this error with 10mb files. It still works with small files (binaries & text), but now it does not with 10mb binaries...
File "/Users/programmer/python/dbupload/upload.py", line 42, in upload_file br.submit() File "build/bdist.macosx-10.7-intel/egg/mechanize/_mechanize.py", line 541, in submit return self.open(self.click(*args, **kwds)) File "build/bdist.macosx-10.7-intel/egg/mechanize/_mechanize.py", line 203, in open return self._mech_open(url, data, timeout=timeout) File "build/bdist.macosx-10.7-intel/egg/mechanize/_mechanize.py", line 230, in _mech_open response = UserAgentBase.open(self, request, data) File "build/bdist.macosx-10.7-intel/egg/mechanize/_opener.py", line 193, in open response = urlopen(self, req, data) File "build/bdist.macosx-10.7-intel/egg/mechanize/_urllib2_fork.py", line 344, in _open '_open', req) File "build/bdist.macosx-10.7-intel/egg/mechanize/_urllib2_fork.py", line 332, in _call_chain result = func(*args) File "build/bdist.macosx-10.7-intel/egg/mechanize/_urllib2_fork.py", line 1170, in https_open return self.do_open(conn_factory, req) File "build/bdist.macosx-10.7-intel/egg/mechanize/_urllib2_fork.py", line 1116, in do_open r = h.getresponse() File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py", line 1013, in getresponse File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py", line 402, in begin File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py", line 366, in _read_status
I'm not sure what to tell you about the issue that you are experiencing with large files. I was not able to duplicate it, but I'm running Linux, so I suppose the problem could be OS related.
Thanks Jon. It is happening in both Windows and MacOSX. Any ideas as to where the issue may lay? I tried extending the timeout, but that didn't do anything. Again, it was working great, but just stopped. Perhaps a new version of Mechanize came out?
As far as I know, there haven't been any recent changes to Mechanize which would cause this. Here's the change log:
http://wwwsearch.sourceforg...
I would have suggested extending the timeout, but since you already tried that, I'm not sure where the best place is to look. If I have a chance in the near future, I will try this using Python 2.7 on Windows. In the mean time, you could try this with Python 2.6 and see if it works. I don't know why it would make a difference, but my web server is still on 2.6, so that what I tested it on.
Edit:
I've now tried it on Windows 7 32-bit using Python 2.7, and I was unable to duplicate the issue. I was able to upload a 15MB file without issue. Could this be an upstream issue with your network connection?
Thanks for all the help. I have tried on 5 different networks (OSX & Windows on each) and none of them work. Crazy...Back to the code (but again, it didnt change!)
In some manual testing, I have found my two accounts get a 500 error when going to https://dl-web.dropbox.com/...
Does this happen to you as well?
I think that is normal. It's expecting a file in a post request.
No problem. Have you tried uploading the file via the normal web interface manually? It's possible that your account is being throttled in some way.
I can upload the file just fine via the web interface. Check out this thread...
http://forums.dropbox.com/t...
Interesting. I wouldn't expect that this is related to your problem. The script doesn't use the official API, it just scrapes the website.
Yeah, looking at it now, multiple accounts are getting ERR_EMPTY_RESPONSE when uploading large files. Trying 5MB instead of 10 and it isn't working.
Good on you.
All the Best
rafg1
Anyone see an error like:
Traceback (most recent call last):
File "dropbox_upload.py", line 43, in <module>
upload_file("tmp.txt", "test", "tmp_remote.txt", "...", "...")
File "dropbox_upload.py", line 41, in upload_file
br.submit()
File "C:\Python26\lib\site-packages\mechanize\_mechanize.py", line 541, in submit
return self.open(self.click(*args, **kwds))
File "C:\Python26\lib\site-packages\mechanize\_mechanize.py", line 203, in open
return self._mech_open(url, data, timeout=timeout)
File "C:\Python26\lib\site-packages\mechanize\_mechanize.py", line 255, in _mech_open
raise response
mechanize._response.httperror_seek_wrapper: HTTP Error 404: Not Found
Has anyone done any testing with this on Python 3.1?
As far as I know, this has not been tested in Python 3.x. It's a very small amount of code, so there shouldn't be much to change, though.
At some point, perhaps I will install 3.1 and see if this works.
I did some reading, and it looks like mechanize isn't available for Python 3, yet. Until that gets ported over, this isn't going to work in Python 3 without a complete rewrite.
I'm trying to get this working on an Ubuntu Hardy server to upload a nightly sqldump into my dropbox. I checked out the current revision and tried to run the example.py script, but encountered this error:
Traceback (most recent call last):
File "example.py", line 7, in <module>
upload_file("example.py","/","dbupload_test.txt",email,password)
File "/home/zach/PythonDropboxUploader/src/dbupload/upload.py", line 24, in upload_file
br.select_form(predicate=isUploadForm)
File "/usr/lib/python2.5/site-packages/mechanize/_mechanize.py", line 492, in select_form
for form in self.forms():
File "/usr/lib/python2.5/site-packages/mechanize/_mechanize.py", line 414, in forms
return self._factory.forms()
File "/usr/lib/python2.5/site-packages/mechanize/_html.py", line 534, in forms
self._forms_factory.forms())
File "/usr/lib/python2.5/site-packages/mechanize/_html.py", line 226, in forms
raise ParseError(exc)
mechanize._html.ParseError
Do you know if Dropbox changed their login page or am I doing something wrong?
Thanks
As far as I know, the website has not been changed in a way that breaks this script. It is still working fine for me. I've never personally seen the error that you are getting, but I've also never tried it using Python 2.5. I'm using 2.6 and I've tested it in 2.7.
It's able to find the login form and enter your credentials, but it isn't able to get past that. Are you sure you are using the right email and password?
I'm trying to
Seems to only work on text files, not binaries. Is that true?
I seem to be having the same problem :(
Only plain text files are good, nothing else works.
Can anyone help?
Thanks!
Are you getting any errors? What version of Python are you running? What OS?
There is a size limit using the upload functionality on the Dropbox website, which this uses, so if your trying to upload a very large file, it will fail.
Sorry, should've added more information:
I'm running Python 2.5.1 on Window 7 Ultimate 32-bit.
Also, I'm not getting any errors. What happens is any text file uploads as it should, no problem. However, if I'm trying any other file, it seems to upload a file with the exact same name to the location given, but the file size is <1kb. All files I've tried uploading have been under 10mb.
Hope that helps a bit more.
I think I have solved this problem. It was only a bug on Windows because Windows handles binary files differently than text files. Now I simply send everything as binary.
I just pushed the updated code, so check it out and let me no if you are still experiencing problems.
Yep, it seems to be working fine now! I'll let you know know if anything else comes up.
Thanks a lot for the quick responses and fixes! :)
You bet. I'm glad it's working for you now.
I use it on binary files without any problems. I routinely use it to upload zips. Is there anything else that could be causing the problem?
after i downloaded your script, i run it. this is the output
Enter Dropbox email address:XXX@YYY.ZZ
Enter Dropbox password:
Traceback (most recent call last):
File "example.py", line 7, in <module>
upload_file("example.py","/","dbupload_test.txt",email,password)
File "/home/thundertr/jncraton-PythonDropboxUploader-ab3a4d0/src/dbupload/upload.py", line 16, in upload_file
br["login_email"] = email
File "/usr/lib/python2.6/site-packages/ClientForm.py", line 2895, in __setitem__
control = self.find_control(name)
File "/usr/lib/python2.6/site-packages/ClientForm.py", line 3222, in find_control
return self._find_control(name, type, kind, id, label, predicate, nr)
File "/usr/lib/python2.6/site-packages/ClientForm.py", line 3306, in _find_control
raise ControlNotFoundError("no control matching "+description)
ClientForm.ControlNotFoundError: no control matching name 'login_email'
What's wrong? could you help me?
thanks
Max
It seems that there was some different behavior between different versions of Python or perhaps the mechanize library. I did the original development for this on Python 2.5.
Anyhow, I've committed a bug fix which at least solved the problem that you are having for me. Let me know if you are still having problems.
I'm using Opensuse 11.3 with Python 2.6.5 (r265:79063, Jul 5 2010, 11:47:21). And with this new version i can upload my files.
Thank you very much.
Max
Great! I'm glad that worked for you.
Am trying to run this code, but gets an error while providing the credentials. some help please ??
nsadmin@squid-proxy1:~$
nsadmin@squid-proxy1:~$ python
Python 2.7.3 (default, Sep 26 2013, 20:03:06)
[GCC 4.6.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>>
>>> import mechanize
>>> br = mechanize.Browser()
>>> br.open('https://www.dropbox.com/log...
<response_seek_wrapper at="" 0x1372b48="" whose="" wrapped="" object="<closeable_response" at="" 0x1372830="" whose="" fp="<socket._fileobject" object="" at="" 0x7fe35fdeac50="">>>
>>> isLoginForm = lambda f: f.action == "https://www.dropbox.com/login"
>>> br.select_form(predicate=isLoginForm)
>>> br["login_email"] = 'salehnoordeen@gmail.com'
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python2.7/dist-packages/mechanize-0.2.5-py2.7.egg/mechanize/_form.py", line 2780, in __setitem__
control = self.find_control(name)
File "/usr/local/lib/python2.7/dist-packages/mechanize-0.2.5-py2.7.egg/mechanize/_form.py", line 3101, in find_control
return self._find_control(name, type, kind, id, label, predicate, nr)
File "/usr/local/lib/python2.7/dist-packages/mechanize-0.2.5-py2.7.egg/mechanize/_form.py", line 3185, in _find_control
raise ControlNotFoundError("no control matching "+description)
mechanize._form.ControlNotFoundError: no control matching name 'login_email'
>>>
>>>
I'm afraid that I haven't been keeping the example code in the blog post up to date. The code on Github is working fine at the moment, and you should have better luck if you start from there. Let me know if you get stuck!
Got it working...Thanks
I downloaded the zip file from github and it had the test.py file which does this from below link
https://github.com/jncraton...
But, is there an option to run this test without downloading any zip, the way you wrote earlier ?
Thanks
I meant to say, if i want to run the script from any machine, i do not want the dependency of having these files downloaded/added in each machine..
Thanks
thanks a lot, man!
exactly what i need