Traceback (most recent call last):
File “/usr/lib/python3/dist-packages/odoo/http.py”, line 646, in _handle_exception
return super(JsonRequest, self)._handle_exception(exception)
File “/usr/lib/python3/dist-packages/odoo/http.py”, line 307, in _handle_exception
raise pycompat.reraise(type(exception), exception, sys.exc_info()[2])
File “/usr/lib/python3/dist-packages/odoo/tools/pycompat.py”, line 87, in reraise
raise value
File “/usr/lib/python3/dist-packages/odoo/http.py”, line 683, in dispatch
result = self._call_function(**self.params)
File “/usr/lib/python3/dist-packages/odoo/http.py”, line 339, in _call_function
return checked_call(self.db, *args, **kwargs)
File “/usr/lib/python3/dist-packages/odoo/service/model.py”, line 97, in wrapper
return f(dbname, *args, **kwargs)
File “/usr/lib/python3/dist-packages/odoo/http.py”, line 332, in checked_call
result = self.endpoint(*a, **kw)
File “/usr/lib/python3/dist-packages/odoo/http.py”, line 927, in call
return self.method(*args, **kw)
File “/usr/lib/python3/dist-packages/odoo/http.py”, line 512, in response_wrap
response = f(*args, **kw)
File “/mnt/extra-addons/web/controllers/main.py”, line 977, in call_button
action = self._call_kw(model, method, args, {})
File “/mnt/extra-addons/web/controllers/main.py”, line 965, in _call_kw
return call_kw(request.env[model], method, args, kwargs)
File “/usr/lib/python3/dist-packages/odoo/api.py”, line 689, in call_kw
return call_kw_multi(method, model, args, kwargs)
File “/usr/lib/python3/dist-packages/odoo/api.py”, line 680, in call_kw_multi
result = method(recs, *args, **kwargs)
File “/mnt/extra-addons/muk_dms_octadocs/models/dms_file.py”, line 1859, in publicar_doc
self.publicar_documento(self._uid)
File “/mnt/extra-addons/muk_dms_octadocs/models/dms_file.py”, line 1950, in publicar_documento
self.convertir_documento()
File “/mnt/extra-addons/muk_dms_octadocs/models/dms_file.py”, line 1649, in convertir_documento
result = words_api.convert_document(request)
File “/usr/local/lib/python3.5/dist-packages/asposewordscloud/apis/words_api.py”, line 1294, in convert_document
data = self.convert_document_with_http_info(request, **kwargs) # noqa: E501
File “/usr/local/lib/python3.5/dist-packages/asposewordscloud/apis/words_api.py”, line 1351, in convert_document_with_http_info
collection_formats=http_params[‘collection_formats’]))
File “/usr/local/lib/python3.5/dist-packages/asposewordscloud/api_client.py”, line 468, in call_api
_preload_content, _request_timeout)
File “/usr/local/lib/python3.5/dist-packages/asposewordscloud/api_client.py”, line 156, in __call_api
self.request_token()
File “/usr/local/lib/python3.5/dist-packages/asposewordscloud/api_client.py”, line 143, in request_token
access_token = return_data[‘access_token’] if six.PY3 else return_data[‘access_token’].encode(‘utf8’)
TypeError: string indices must be integers
It seems that you are encountering a TypeError
when trying to convert a Word document to PDF using the Aspose.Words Cloud API in a Docker environment. The error message indicates that there is an issue with accessing the access_token
from the response data, which suggests that the response might not be in the expected format.
Here are a few steps you can take to troubleshoot and potentially resolve this issue:
-
Check API Credentials: Ensure that your API credentials (client ID and client secret) are correctly set up and that you have the necessary permissions to access the Aspose.Words Cloud API.
-
Inspect the Response: Before accessing the
access_token
, print or log the entire response from the API call to see what data is being returned. This can help you identify if the response structure is different from what you expect. -
Update SDK: Make sure you are using the latest version of the Aspose.Words Cloud SDK. Sometimes, issues are resolved in newer versions, so updating might help.
-
Error Handling: Implement error handling to manage unexpected responses gracefully. This can include checking if the response contains the expected keys before trying to access them.
-
Review Documentation: Consult the Aspose.Words Cloud API documentation for any changes or updates regarding the authentication process or the expected response format.
-
Example Code: If you are looking for a code example on how to convert a document, you can refer to the provided Java code snippet that demonstrates how to convert a document to PDF using the Aspose.Words Cloud API. This example includes setting up the request and handling the response properly.
If the issue persists after trying these steps, consider reaching out to Aspose support with detailed information about your environment and the steps you’ve taken.
Feel free to ask if you need further assistance!
Sources:
[1]: TestConvertDocument.java
alguna otra solucion mas presisa
ya el inconveniente lo tengo en todos los documentos que voy a publicar
presenta como que debo de hacer actualizacion de librerias en el cloud apause
Por favor, comparte con nosotros el código que estás ejecutando para una mayor depuración.
que seria programacion no bajar alguna otra actualizacion
Traceback (most recent call last):
File “/usr/lib/python3/dist-packages/odoo/http.py”, line 646, in _handle_exception
return super(JsonRequest, self)._handle_exception(exception)
File “/usr/lib/python3/dist-packages/odoo/http.py”, line 307, in _handle_exception
raise pycompat.reraise(type(exception), exception, sys.exc_info()[2])
File “/usr/lib/python3/dist-packages/odoo/tools/pycompat.py”, line 87, in reraise
raise value
File “/usr/lib/python3/dist-packages/odoo/http.py”, line 683, in dispatch
result = self._call_function(**self.params)
File “/usr/lib/python3/dist-packages/odoo/http.py”, line 339, in _call_function
return checked_call(self.db, *args, **kwargs)
File “/usr/lib/python3/dist-packages/odoo/service/model.py”, line 97, in wrapper
return f(dbname, *args, **kwargs)
File “/usr/lib/python3/dist-packages/odoo/http.py”, line 332, in checked_call
result = self.endpoint(*a, **kw)
File “/usr/lib/python3/dist-packages/odoo/http.py”, line 927, in call
return self.method(*args, **kw)
File “/usr/lib/python3/dist-packages/odoo/http.py”, line 512, in response_wrap
response = f(*args, **kw)
File “/mnt/extra-addons/web/controllers/main.py”, line 977, in call_button
action = self._call_kw(model, method, args, {})
File “/mnt/extra-addons/web/controllers/main.py”, line 965, in _call_kw
return call_kw(request.env[model], method, args, kwargs)
File “/usr/lib/python3/dist-packages/odoo/api.py”, line 689, in call_kw
return call_kw_multi(method, model, args, kwargs)
File “/usr/lib/python3/dist-packages/odoo/api.py”, line 680, in call_kw_multi
result = method(recs, *args, **kwargs)
File “/mnt/extra-addons/muk_dms_octadocs/models/dms_file.py”, line 1859, in publicar_doc
self.publicar_documento(self._uid)
File “/mnt/extra-addons/muk_dms_octadocs/models/dms_file.py”, line 1950, in publicar_documento
self.convertir_documento()
File “/mnt/extra-addons/muk_dms_octadocs/models/dms_file.py”, line 1649, in convertir_documento
result = words_api.convert_document(request)
File “/usr/local/lib/python3.5/dist-packages/asposewordscloud/apis/words_api.py”, line 1294, in convert_document
data = self.convert_document_with_http_info(request, **kwargs) # noqa: E501
File “/usr/local/lib/python3.5/dist-packages/asposewordscloud/apis/words_api.py”, line 1351, in convert_document_with_http_info
collection_formats=http_params[‘collection_formats’]))
File “/usr/local/lib/python3.5/dist-packages/asposewordscloud/api_client.py”, line 468, in call_api
_preload_content, _request_timeout)
File “/usr/local/lib/python3.5/dist-packages/asposewordscloud/api_client.py”, line 156, in __call_api
self.request_token()
File “/usr/local/lib/python3.5/dist-packages/asposewordscloud/api_client.py”, line 143, in request_token
access_token = return_data[‘access_token’] if six.PY3 else return_data[‘access_token’].encode(‘utf8’)
TypeError: string indices must be integers
es lo que me presenta al intentar publicar cualquier documento
Envíame también el código Python que utilizas y comparte qué versión del SDK utilizas.
donde visualizo la version del sdk me indica que no tiene
@api.multi
def convertir_documento(self):
extensiones = [
“.docx”,“.doc”,“.odt”,
“.xlsx”,“.xls”,“.ods”,
“.pptx”,“.ppt”,“.odp”
]
if self.state == ‘publicación’:
documento = self.env[‘muk_dms.file’].search([(‘id’,‘=’,self.id)])
for var in documento:
if var.extension in extensiones:
next_seq=“_V”+str(self.version_doc)+“.”+str(self.pass_version)
path_version=self.path_version_format(self.path,next_seq)
path = “/mnt/extra-addons/muk_dms/static/src/php” + path_version
dirname, fname=os.path.split(path.rstrip(‘/’))
os.chdir(dirname)
words_api = asp.WordsApi(client_id = ‘4a45c2ec-8c65-417e-8f46-4eda66ae4720’,
client_secret = ‘2c7ec7608ac3f43ae9769669aeab6fc8’)
request_document = open(os.path.join(path), ‘rb’)
request = asp.models.requests.ConvertDocumentRequest(document=request_document, format=‘pdf’)
result = words_api.convert_document(request)
nombre_pdf=self.name.split(‘.’)[0]+next_seq+‘.pdf’
f= open(nombre_pdf,‘wb’)
f.write (result)
f.close()
with open(nombre_pdf, “rb”) as f:
data = f.read()
file=bytes(base64.b64encode(data))
f.close()
self.write({‘xls_filename’:nombre_pdf,‘archivo_xls’:file})
return True
se me cae en esta linea
request = asp.models.requests.ConvertDocumentRequest(document=request_document, format=‘pdf’)
si quisiera contratar algun servicio premiun para que me puedan ayuidar con una solucion
urgente
Intente no utilizar argumentos nombrados en el constructor y verifique si funciona
words_api = asp.WordsApi(“4a45c2ec-8c65-417e-8f46-4eda66ae4720”, “2c7ec7608ac3f43ae9769669aeab6fc8”)
Además, actualice el SDK a la última versión que está disponible aquí y su versión es 24.12 aspose-words-cloud · PyPI
si trate de instalarlo y muesta el error
En tu captura de pantalla veo que tienes Python 2.7, la versión mínima de Python es 3.4.
cheverisimo si se instalo pero ahora no quiere levantar
por el tema de librerias @typing_extensions.deprecated(“ProtectionRequest is deprecated and remains for backwards compatibility only.”)
AttributeError: module ‘typing_extensions’ has no attribute ‘deprecated’
2025-01-09 15:25:24,353 1 INFO jueves werkzeug: 172.16.23.29 - - [09/Jan/2025 15:25:24] “GET /web?db%3Djueves HTTP/1.1” 500 -
2025-01-09 15:25:24,371 1 ERROR jueves werkzeug: Error on request: