I am experiencing a problem with accessing a google drive spreadsheet from my pi with gspread. Using the following code - I have moved the the python IDLE to try and resolve the issue.
>>> import gspread
>>> gc = gspread.login('username', 'password')
>>> spreadsheet=gc.open('Spreadsheet')
>>> Log_sheet = spreadsheet.worksheet("Sheet1")
>>> Log_sheet.acell('B1').value
'Value # B1'`
I have tried using the same code in the command line from my computer (checked versions) and it works fine with the result above. I have updated the version on my pi
The error happens on the pi after the line >>>Log_sheet = spreadsheet.worksheet("Sheet1")
so I have logged in and access the google spreadsheet - its accessing the worksheet - it does exist and I can access from my computer. I have also posted a request for help on the Raspberry Pi site.
Can anyone help? Here is the error output.
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python3.1/dist-packages/gspread/models.py", line 123, in worksheet
self._fetch_sheets()
File "/usr/local/lib/python3.1/dist-packages/gspread/models.py", line 62, in _fetch_sheets
self._sheet_list.append(Worksheet(self, elem))
File "/usr/local/lib/python3.1/dist-packages/gspread/models.py", line 168, in __init__
self.version = element.find(_ns("link[#rel='edit']")).attrib['href'].split('/')[-1]
File "/usr/lib/python3.1/xml/etree/ElementTree.py", line 305, in find
return ElementPath.find(self, path)
File "/usr/lib/python3.1/xml/etree/ElementPath.py", line 186, in find
return _compile(path).find(element)
File "/usr/lib/python3.1/xml/etree/ElementPath.py", line 176, in _compile
p = Path(path)
File "/usr/lib/python3.1/xml/etree/ElementPath.py", line 93, in __init__
"expected path separator (%s)" % (op or tag)
SyntaxError: expected path separator ([)
I have also tried reinstalling elementtree, as I saw this could be a possibility on my search for an answer, I have also tried python 3.1 on the pi, still no joy.
please can anyone help? I think its something really easy but I am not seeing it
It is related to incompatible use of ElementTree API in gspread itself and it is fixed in 0.1.0.
Related
I'v been trying to launch project(example_setup folder):
https://github.com/OTA-Insight/djangosaml2idp/tree/master/example_setup
I can anybody answer to men according with documentation. But it does not working. First problem, as I undesrtand is in date of methadata in SP(idp_metadata.xml)- validUntil="2020-12-27T12:41:18Z"> . It does not valid at the moment, and was changed to future date, as example(validUntil="2030-12-27T12:41:18Z"). But next I got another problem when trying to sign in to SP(localhost:8000) in my browser, I have more problem:
Error during SAML2 authentication
IncorrectlySigned
In attempts to find problem, I found the place where it is occured. In original it iis in tryexcept block, and can't be found easy.
Traceback (most recent call last):
File "/home/dmitriy/projects/djangosaml2idp/example_setup/idp/djangosaml2idp/views.py", line 251, in get
req_info = idp_server.parse_authn_request(request.session['SAMLRequest'], binding)
File "/home/dmitriy/projects/djangosaml2idp/example_setup/idp/venv/lib/python3.8/site-packages/saml2/server.py", line 238, in parse_authn_request
return self._parse_request(enc_request, AuthnRequest,
File "/home/dmitriy/projects/djangosaml2idp/example_setup/idp/venv/lib/python3.8/site-packages/saml2/entity.py", line 1036, in _parse_request
_request = _request.loads(xmlstr, binding, origdoc=enc_request,
File "/home/dmitriy/projects/djangosaml2idp/example_setup/idp/venv/lib/python3.8/site-packages/saml2/request.py", line 110, in loads
return self._loads(xmldata, binding, origdoc, must,
File "/home/dmitriy/projects/djangosaml2idp/example_setup/idp/venv/lib/python3.8/site-packages/saml2/request.py", line 51, in _loads
print(self.signature_check(xmldata, origdoc=origdoc,
File "/home/dmitriy/projects/djangosaml2idp/example_setup/idp/venv/lib/python3.8/site-packages/saml2/sigver.py", line 1662, in correctly_signed_authn_request
return self.correctly_signed_message(decoded_xml, 'authn_request', must, origdoc, only_valid_cert=only_valid_cert)
File "/home/dmitriy/projects/djangosaml2idp/example_setup/idp/venv/lib/python3.8/site-packages/saml2/sigver.py", line 1653, in correctly_signed_message
return self._check_signature(
File "/home/dmitriy/projects/djangosaml2idp/example_setup/idp/venv/lib/python3.8/site-packages/saml2/sigver.py", line 1503, in _check_signature
raise MissingKey(_issuer)
saml2.sigver.MissingKey: http://localhost:8000/saml2/metadata/
Internal Server Error: /idp/login/process/
Some key is missing:
Error during SAML2 authentication
MissingKey
http://localhost:8000/saml2/metadata/
My idp_metada in the SP is like in the [example_setup][1] folder of project, only validUntil has been changed as I said above, user in IDP has been created as superuser, I also tried to create user in the SP, the same as in the IDP, but nothing changed
Can anybody anser to me, what my problem is?
It's no any information in docs. But you need to create SP inside IDP from admin panel. That was resolved my problem.
I've a weird problem. I have coded a little python script to test if my idea would work (no worries, it's just for fun). I am trying to simply open visio, place a couple of objects and close it.
#Get visio application
import win32com.client as win32
visio = win32.gencache.EnsureDispatch('Visio.Application')
visio.Visible = True
And it worked, so I've left it as it is for this week and when I tested it again it gave me an error which didn't occur last time, and closed the application.
Traceback (most recent call last):
File "c:\Users\lars\OneDrive - HAN\School LJ 3\Stage\Stageopdrachten\Opdracht interactive netwerktekening\Programma\main.py", line 3, in <module>
visio = win32.gencache.EnsureDispatch('Visio.Application')
File "C:\Users\lars\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\win32com\client\gencache.py", line 524, in EnsureDispatch
disp = win32com.client.Dispatch(prog_id)
File "C:\Users\lars\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\win32com\client\__init__.py", line 96, in Dispatch
return __WrapDispatch(dispatch, userName, resultCLSID, typeinfo, clsctx=clsctx)
File "C:\Users\lars\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\win32com\client\__init__.py", line 37, in __WrapDispatch
klass = gencache.GetClassForCLSID(resultCLSID)
File "C:\Users\lars\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\win32com\client\gencache.py", line 180, in GetClassForCLSID
mod = GetModuleForCLSID(clsid)
File "C:\Users\lars\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\win32com\client\gencache.py", line 223, in GetModuleForCLSID
mod = GetModuleForTypelib(typelibCLSID, lcid, major, minor)
File "C:\Users\lars\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\win32com\client\gencache.py", line 263, in GetModuleForTypelib
AddModuleToCache(typelibCLSID, lcid, major, minor)
File "C:\Users\lars\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\win32com\client\gencache.py", line 559, in AddModuleToCache
SetTypelibForAllClsids(mod.CLSIDToClassMap)
AttributeError: module 'win32com.gen_py.00021A98-0000-0000-C000-000000000046x0x4x16' has no attribute 'CLSIDToClassMap'
Does anybody know what happened, or what I'm doing wrong? I've tried to reverse an update that happened in the meantime. I've been looking if the win32com has been updated. Yet nothing did solve it.
I appreciate your assistance.
The awnser to this question has been posted here:
Why am I suddenly getting a no attribute 'CLSIDToPackageMap' error with win32com.client?
In short the problem can be solved by deleting the gen_py folder found in the temp folder. You can find the temp folder by searching for %temp% or go to c:\users<username>\appdata\local\temp (make sure to show hidden files).
Hope I was able to help.
have been using Spyder via PythonXY and today it stopped working. I seem to be able to start the other utilties in the PythonXY program folder (eg, Mayavi, Ipython console, etc) but neither PythonXY or Spyder will start properly. When I start them from the command line I get the following error trace. Any suggestions on how to fix this (already tried uninstalling and reinstalling pythonxy/python)?
Traceback (most recent call last):
File "C:\Python27\Scripts\xyhome.pyw", line 20, in <module>
from xy import xyhome
File "C:\Python27\lib\site-packages\xy\xyhome.pyw", line 60, in <module>
from xy.config import (CONF, STARTUP_PATH, LOG_PATH, PLUGINS, XY_VERSION,
File "C:\Python27\lib\site-packages\xy\config.py", line 40, in <module>
CONF = UserConfig('xy', defaults=DEFAULTS, version=__version__, subfolder='.
xy')
File "C:\Python27\lib\site-packages\xy\userconfig.py", line 110, in __init__
if version != self.get_version(version):
File "C:\Python27\lib\site-packages\xy\userconfig.py", line 130, in get_versio
n
return self.get(self.DEFAULT_SECTION_NAME, 'version', version)
File "C:\Python27\lib\site-packages\xy\userconfig.py", line 266, in get
self.set(section, option, default)
File "C:\Python27\lib\site-packages\xy\userconfig.py", line 332, in set
self.__save()
File "C:\Python27\lib\site-packages\xy\userconfig.py", line 167, in __save
self.write(conf_file)
File "C:\Python27\lib\ConfigParser.py", line 407, in write
fp.write("[%s]\n" % section)
TypeError: must be unicode, not str
>>>
when I print out the conf_file from the last userconfig.py call the parameter does appear to be unicode:
<_io.TextIOWrapper name=u'C:\\Users\\rclement\\.xy\\.xy.ini' encoding='utf-8'>
I was able to obtain a working re-installation by deleting the C:\Python27 directory and the associated sub-directories left by non-pythonxy installed packages. No registry changes were made and the Windows environment PATH settings were left as I had set them. I still do not know the cause of the problem.
I did a quick fix for this error
for section in self._sections:
fp.write("[%s]\n" % unicode(section)) #forced conversion to unicode
for (key, value) in self._sections[section].items():
if key == "__name__":
continue
if (value is not None) or (self._optcre == self.OPTCRE):
key = " = ".join((key, str(value).replace('\n', '\n\t')))
fp.write("%s\n" % (unicode(key))) #forced conversion to unicode
fp.write(u"\n") #forced conversion to unicode
This quick fix worked for me. But no idea what caused the problem. :-(
I'm testing ebaysdk Python library that lets you connect to ebay. Now I'm trying examples from: https://github.com/timotheus/ebaysdk-python/
So far I got stuck at this example:
from ebaysdk.shopping import Connection as Shopping
shopping = Shopping(domain="svcs.sandbox.ebay.com", config_file="ebay.yaml")
response = shopping.execute('FindPopularItems',
{'QueryKeywords': 'Python'})
print response.disct()
When I run it. It gives me this error:
Traceback (most recent call last):
File "ebay-test.py", line 13, in <module>
{'QueryKeywords': 'Python'})
File "/usr/local/lib/python2.7/dist-packages/ebaysdk-2.1.0-py2.7.egg/ebaysdk/connection.py", line 123, in execute
self.error_check()
File "/usr/local/lib/python2.7/dist-packages/ebaysdk-2.1.0-py2.7.egg/ebaysdk/connection.py", line 193, in error_check
estr = self.error()
File "/usr/local/lib/python2.7/dist-packages/ebaysdk-2.1.0-py2.7.egg/ebaysdk/connection.py", line 305, in error
error_array.extend(self._get_resp_body_errors())
File "/usr/local/lib/python2.7/dist-packages/ebaysdk-2.1.0-py2.7.egg/ebaysdk/shopping/__init__.py", line 188, in _get_resp_body_errors
dom = self.response.dom()
File "/usr/local/lib/python2.7/dist-packages/ebaysdk-2.1.0-py2.7.egg/ebaysdk/response.py", line 229, in dom
return self._dom
File "/usr/local/lib/python2.7/dist-packages/ebaysdk-2.1.0-py2.7.egg/ebaysdk/response.py", line 216, in __getattr__
return getattr(self._obj, name)
AttributeError: 'Response' object has no attribute '_dom'
Am I missing something here or it could be some kind of bug in library?
Do you have a config file? I had a lot of problems getting started with this SDK. To get the yaml config file to work, I had to specify the directory that it was in. So in your example, it would be:
shopping = Shopping(domain="svcs.sandbox.ebay.com", config_file=os.path.join(os.path.dirname(os.path.realpath(__file__)), 'ebay.yaml'))
You should also be able to specify debug=true in your Shopping() declaration as in Shopping(debug=True).
Make sure if you have not, to specify your APP_ID and other necessary values in the config file.
You have the wrong domain, it should be open.api.sandbox.ebay.com. See this page on the ebaysdk github.
I am getting ImportError: No localization support for language 'eng' when using MySQL Connector in Python.
My Traceback is as below.
Traceback (most recent call last):
File \"DB_Module.py\", line 151, in QueryDatabase
File \"\\share\app\Modules\mysql\connector\__init__.py\", line 44, in Connect
File \"\\share\app\Modules\mysql\connector\connection.py\", line 106, in __init__
File \"\\share\app\Modules\mysql\connector\connection.py\", line 325, in connect
File \"\\share\app\Modules\mysql\connector\connection.py\", line 288, in _open_connection
File \"\\share\app\Modules\mysql\connector\network.py\", line 326, in open_connection
File \"\\sfs\show_time\Showtime_Package\showtime\Modules\mysql\connector\errors.py\", line 160, in __init__
File \"\\share\app\Modules\mysql\connector\locales\__init__.py\", line 52, in get_client_error
ImportError: No localization support for language 'eng'
And my Current used SQL is
SELECT * FROM systemdetails
WHERE System_ID = 'System1' LIMIT 1
Can anyone tell me how to fix this error?
In order for the MySql connector to print the actual error string - it needs the eng/client_error file in the "locales" dir.
I personally, just manually created the dir "eng" and copy-paste the file from this link:
http://pydoc.net/Python/mysql-connector-python/1.0.7/mysql.connector.locales.eng.client_error/
> mkdir eng
> touch eng/__init__.py
> vi eng/client_error.py
> ... copy-paste, save, and exit.
I run the code again, and received:
2013: Lost connection to MySQL server during query
You'll probably get a different error, but hope it helps.
Just put this to import the locale when you compile again with pyInstaller or py2exe.
from mysql.connector.locales.eng import client_error
They will include the modules needed to fix the error.
In my case, changing the latest mysql.connector module to a former version solved the problem. I changed the version from 8.0.30 to 8.0.17.