I'm running the following code to access Smartsheet using Python SDK
access_token = 'XXXX'
smartsheet_client = smartsheet.Smartsheet(access_token)
user_profile = smartsheet_client.Users.get_current_user()
print(user_profile)
But I'm getting the following error
Traceback (most recent call last):
File "D:\Users\rahul\AppData\Local\Programs\Python\Python35-32\lib\site- Traceback (most recent call last):
File "D:\Users\rahul\AppData\Local\Programs\Python\Python35-32\lib\site-packages\urllib3\connection.py", line 157, in _new_conn
(self._dns_host, self.port), self.timeout, **extra_kw
File "D:\Users\rahul\AppData\Local\Programs\Python\Python35-32\lib\site-packages\urllib3\util\connection.py", line 61, in create_connection
for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM):
Can anyone help me resolve this issue?
I'm using smartsheet-python-sdk.
I cannot run from work location
If you are having connection errors from your work location you might have to use a proxy with the Smartsheet Python SDK to connect.
There is info on using a proxy with the Python SDK in the Advanced topics file in the GitHub repo here:
https://github.com/smartsheet-platform/smartsheet-python-sdk/blob/master/ADVANCED.md#http-proxy
Related
Traceback (most recent call last):
File "<string>", line 34, in <module>
File "C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\mp.py", line 105, in CreateWebLayerSDDraft
return _convertArcObjectToPythonObject(arcgisscripting._mapping.CreateWebLayerSDDraft(*_gp_fixargs([map_or_layers, out_sddraft, service_name, server_type, service_type, folder_name, overwrite_existing_service, copy_data_to_server, enable_editing, allow_exporting, enable_sync, summary, tags, description, credits, use_limitations], True)))
ValueError: Staging path is invalid or inaccessible: C:\Users\hagerty_finn\Documents\ArcGIS\Projects\TrafficFatalityCount\temp.txt
Line 34:
arcpy.mp.CreateWebLayerSDDraft(mp, sddraft, sd_fs_name, 'MY_HOSTED_SERVICES', 'FEATURE_ACCESS')
I tried changing the file path to another user and updating the password. The problem persists. I am running this script in ArcGIS Pro Python window on a GIS local server.
I'm a complete beginner. I wanted to download something from github on Termux and everything went fine until the last step when the key error 'csrftoken' appeared. I would really appreciate if someone could help me out. That's the error:
Traceback (most recent call last):
File "/data/data/com.termux/files/home/alkrinsta/alkrinsta.py", line 146, in <module>
sess = instabrute.Login(password)
File "/data/data/com.termux/files/home/alkrinsta/alkrinsta.py", line 106, in Login
sess.headers.update({'X-CSRFToken' : r.cookies.get_dict()['csrftoken']})
KeyError: 'csrftoken'
I am trying to access Azure DevOps server 2020 using the Azure CLI using the following
Link
The Token has full permission and i can access the server using the web portal from the same workstation.
RestAPI Calls to same server works from this workstation
Getting the following error
Creating connection with personal access token.
Failed to authenticate using the supplied token.
Command ran in 28.202 seconds (init: 0.286, invoke: 27.916)
Suppress exception:
Traceback (most recent call last):
File "C:\Users\VSSADM~1\AppData\Local\Temp\pip-unpacked-wheel-2g1ftftt\azure\cli\__main__.py", line 60, in <module>
File "C:\Users\VSSADM~1\AppData\Local\Temp\pip-unpacked-wheel-2g1ftftt\azure\cli\__main__.py", line 53, in <module>
SystemExit: 1
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\VSSADM~1\AppData\Local\Temp\pip-unpacked-wheel-_1bqfhco\azure\cli\core\_profile.py", line 502, in get_current_account_user
File "C:\Users\VSSADM~1\AppData\Local\Temp\pip-unpacked-wheel-_1bqfhco\azure\cli\core\_profile.py", line 511, in get_subscription
knack.util.CLIError: Please run 'az login' to setup account.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\VSSADM~1\AppData\Local\Temp\pip-unpacked-wheel-_1bqfhco\azure\cli\core\decorators.py", line 74, in _wrapped_func
File "C:\Users\VSSADM~1\AppData\Local\Temp\pip-unpacked-wheel-_1bqfhco\azure\cli\core\decorators.py", line 57, in _decorator
File "C:\Users\VSSADM~1\AppData\Local\Temp\pip-unpacked-wheel-_1bqfhco\azure\cli\core\telemetry.py", line 522, in _get_user_azure_id
File "C:\Users\VSSADM~1\AppData\Local\Temp\pip-unpacked-wheel-_1bqfhco\azure\cli\core\_profile.py", line 504, in get_current_account_user
knack.util.CLIError: There are no active accounts.
Suppress exception:
Traceback (most recent call last):
File "C:\Users\VSSADM~1\AppData\Local\Temp\pip-unpacked-wheel-2g1ftftt\azure\cli\__main__.py", line 60, in <module>
File "C:\Users\VSSADM~1\AppData\Local\Temp\pip-unpacked-wheel-2g1ftftt\azure\cli\__main__.py", line 53, in <module>
SystemExit: 1
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\VSSADM~1\AppData\Local\Temp\pip-unpacked-wheel-_1bqfhco\azure\cli\core\decorators.py", line 74, in _wrapped_func
File "C:\Users\VSSADM~1\AppData\Local\Temp\pip-unpacked-wheel-_1bqfhco\azure\cli\core\telemetry.py", line 532, in _get_azure_subscription_id
File "C:\Users\VSSADM~1\AppData\Local\Temp\pip-unpacked-wheel-_1bqfhco\azure\cli\core\_profile.py", line 528, in get_subscription_id
File "C:\Users\VSSADM~1\AppData\Local\Temp\pip-unpacked-wheel-_1bqfhco\azure\cli\core\_profile.py", line 511, in get_subscription
knack.util.CLIError: Please run 'az login' to setup account.
My Solution was
Install The Beta Version of the Azure-Cli - https://aka.ms/installazurecliwindowsbeta
Set The following REQUESTS_CA_BUNDLE - PEM format
I am not able to connect to mysql using python. I have installed mysql-connector but not able to connect Please review my code and let me know where to make a change
I have gone through search engines but couldn't find a solution
import mysql.connector as mysql
mydb = mysql.connect(
host="localhost",
user="root",
password="",
)
Traceback (most recent call last): File
"C:\Users\varma\OneDrive\Documents\lib\site-packages\mysql\connector\network.py",
line 529, in open_connection
self.sock.connect(sockaddr) ConnectionRefusedError: [WinError 10061] No connection could be made because the target machine actively
refused it
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File
"C:/Users/varma/OneDrive/Documents/try.py", line 6, in
password="", File "C:\Users\varma\OneDrive\Documents\lib\site-packages\mysql\connector__init__.py",
line 173, in connect
return MySQLConnection(*args, **kwargs) File "C:\Users\varma\OneDrive\Documents\lib\site-packages\mysql\connector\connection.py",
line 104, in init
self.connect(**kwargs) File "C:\Users\varma\OneDrive\Documents\lib\site-packages\mysql\connector\abstracts.py",
line 780, in connect
self._open_connection() File "C:\Users\varma\OneDrive\Documents\lib\site-packages\mysql\connector\connection.py",
line 284, in _open_connection
self._socket.open_connection() File "C:\Users\varma\OneDrive\Documents\lib\site-packages\mysql\connector\network.py",
line 532, in open_connection
errno=2003, values=(self.get_address(), _strioerror(err))) mysql.connector.errors.InterfaceError: 2003: Can't connect to MySQL
server on 'localhost:3306' (10061 No connection could be made because
the target machine actively refused it)
Working with Python 3.7.3, still figuring out how exception handling works.
I'm writing an xmpp bot, using slixmpp. I'm trying to make it so that if it loses connection to the server, it will try to reconnect. There doesn't seem to be any way to do this built in to slixmpp, so I'm write something into my own code to do it.
I've imported slixmpp as xmpp, and using it's send_raw() method to test that we're still connected to the server.
while True:
time.sleep(5) # Send every 5 seconds just for testing purposes
xmpp.send_raw('aroo?')
When I sever the connection to the server, this is what it spits out:
Traceback (most recent call last):
File "C:\Program Files\Python37\lib\threading.py", line 917, in _bootstrap_inner
self.run()
File "testcom.py", line 19, in run
eval(self.thing)()
File "testcom.py", line 28, in check_conn
xmpp.send_raw('aroo?')
File "C:\Program Files\Python37\lib\site-packages\slixmpp\xmlstream\xmlstream.py", line 926, in send_raw
raise NotConnectedError
slixmpp.xmlstream.xmlstream.NotConnectedError
I'm assuming that "NotConnectedError" is the exception that I need to catch, so I put the code inside a try block, like so:
try:
while True:
time.sleep(5) # Send every 5 seconds just for testing purposes
xmpp.send_raw('aroo?')
except NotConnectedError:
# Do a thing
pass
And this is what I get:
Traceback (most recent call last):
File "testcom.py", line 28, in check_conn
xmpp.send_raw('aroo?')
File "C:\Program Files\Python37\lib\site-packages\slixmpp\xmlstream\xmlstream.py", line 926, in send_raw
raise NotConnectedError()
slixmpp.xmlstream.xmlstream.NotConnectedError
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Program Files\Python37\lib\threading.py", line 917, in _bootstrap_inner
self.run()
"testcom.py", line 19, in run
eval(self.thing)()
File "testcom.py", line 29, in check_conn
except NotConnectedError:
NameError: name 'NotConnectedError' is not defined
Can anyone tell me what I'm doing wrong here?
Thanks!
I can't see your imports but make sure you have from slixmpp.xmlstream.xmlstream import NotConnectedError otherwise it doesn't have a definition for NotConnectedError within the application. You could also change NotConnectedError to xmpp.xmlstream.xmlstream.NotConnectedError if you don't want to have it imported as well.