New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
OSError: [WinError 10013] An attempt was made to access a socket in a way forbidden by its access permissions #86
Comments
I solved this by updating the run_local_server function in the flow.py module of the google_auth_oauthlib package. I changed the port from 8080 to 8090. There should be some conditional logic to see if 8080 is open so that new users of the Google API, like me, don't get frustrated so early on and give up. I learned a lot about sockets (a socket is literally an IP address and a port number paired together), netstat, and working with the UAC from Python trying to figure this out though. |
Is this NOT supposed to be run in Python 3? Does it need to be on Python 2.7? |
I got it to work in Python 3.6. @doverradio Might have you try something you're not used to. We're going to see if port 8085 is in use or not using a command in your terminal called netstat. If it's not in use, there's probably some UAC or firewall issue going on. So, your terminal has a command called netstat. NETSTAT displays all TCP and UPD connections (sockets) that are currently active. We'll confirm that port 8085, the one you've used, is not in use. To see all the sockets (each of which are displayed as "IP-address:port") that are in use, type into your terminal "netstat -a". This will show all the sockets in use. Of all these, to directly see if 8085 is in use, type:
Let us know if 8085 is in there. If it is, change your port to something not in use. If it isn't there, let us know, so we can see how else this error might occur. |
@Crowbrammer I did netstat -na | find "8085" (I'm on Windows 7 64-Bit) but got no value returned. I'm doing this from an @gmail.com account. Could part of this complication be due to free @gmail.com and not paid Gsuite account? I do have a paid Gsuite so I could just retry with that account. Can you confirm this can be done all within a @gmail.com account (free one)? |
Not sure what is different but I retried everything on a new PC and it worked as expected from using this script below and having to re-run Script:
Error: Solution: After doing these things, I ran 'python quickstart.py' and got Chrome window asking me to authorize. So, it appears working. Thank you! Please let me know the type of account (free @gmail.com or paid) and within that, whether it must be a Service account or non-Service account which may be used (or both, I don't know). |
@doverradio I used a free Gmail account. I did not use a Service account. I'll get back to you if I learn anything new about this. |
I have tried on three win 10 machines after installing the current version of python 3.7.3 to follow this example and get the same error. I'll note netstat -na | find "8085" gives no result in an elevated cmd prompt. |
Some searching indicates that Windows may require you to run the program as an administrator. Can you try that and see if it alleviates the issue? Another workaround would be to replace the call to This flow doesn't spin up a local server, and therefore doesn't require you to open any ports. |
The script was run via a command prompt launched as Adminstrator at all times. Looking at the full error I found the flow.py file under the google_auth_olib folder in the local python install (Lib\site-packages folder). From here I search for "localhost" to find the line with the port in it and change the 8080 to 8088 and reran the script - working!.
The server strategy instructs the user to open the authorization URL in I'm guessing this will be undone if / when updates are made to the Google Oauth library files though .. would be good to be able to define or set this in the 'example' file? |
What I meant was that the |
I got this to work by calling |
* Update oauthlib, set port to 0 in oauth flow to use ephemeral ports. Fixes #86. * Update oauthlib version for gmail quickstart, missed in previous commit
net stop hns; net start hns |
Expected Behavior
Trying to run quickstart on python 3.6
Actual Behavior
Got error:
C:\Users\Uber-Admin\Desktop\Google Drive!GIF PROJECT\Python\Python 3.x\Requests
Steps to Reproduce the Problem
C:\Users\Uber-Admin\Desktop\Google Drive!GIF PROJECT\Python\Python 3.x\Requests
Specifications
python --version
) Python 3.6.3 :: Anaconda custom (64-bit)My OS is Windows 7 64-bit Pro
The text was updated successfully, but these errors were encountered: