Page 1 of 1

[Solved] Python: asyncio module

PostPosted: Fri Jun 26, 2020 3:07 pm
by buffercache
Hi !

I got issue with asyncio python module
got this error : <class 'AttributeError'>: module 'asyncio' has no attribute 'get_event_loop'

Is there somewhere the list of available modules and restrictions for openoffice python ?

The following code works using standard python

Code: Select all   Expand viewCollapse view
import datetime
import time
#from pytz import timezone
import sys
import asyncio

event_loop = asyncio.get_event_loop()

def AddClock():
    COLUMN_A = 0
    FIRST_ROW = 7
    SHEET_NAME= "Horaire"
    #oDoc = XSCRIPTCONTEXT.getDocument()
    #oSheet = oDoc.Sheets.getByName(SHEET_NAME)
    #oCell = oSheet.getCellByPosition(COLUMN_A, FIRST_ROW)
    def keep_changing_time(loop,N):
        loop.call_at(N + 1, keep_changing_time, loop, N + 1)
        #oCell.setFormula("%d/%m/%Y %H:%M:%S EST"))
        print("%d/%m/%Y %H:%M:%S EST"))

        NOW = event_loop.time() // 1 + 1
        event_loop.call_at(NOW, keep_changing_time, event_loop, NOW)


Re: Python : asyncio module

PostPosted: Fri Jun 26, 2020 6:34 pm
by MrProgrammer
Hi, and welcome to the forum.

buffercache wrote:Is there somewhere the list of available modules and restrictions for openoffice python ?
buffercache signature wrote:Open Office 4.1
Libre Office Version : 6.4.4.
I do not use Python, however my web search found:
OpenOffice 4.1 uses Python 2.7.
LibreOffice 6.4 uses Python 3.7.
asyncio requires Python Version 3.4.

You may find other Python facilities which are common to the two Python versions that would allow your code to work with both suites. I do not know if it is practical to configure OpenOffice to use Python version 3. A search of the forum might answer that question for you.

If this solved your problem please go to your first post use the Edit button and add [Solved] to the start of the title. You can select the green checkmark icon at the same time.

Re: Python : asyncio module

PostPosted: Mon Jun 29, 2020 10:59 am
by buffercache
Thanks for your reply

  • LibreOffice asyncio ( C:\Program Files\LibreOffice\program\python-core-3.7.7\lib\asyncio ) contains 4 files
  • Standard asyncio module contains 26 files ...

Seems to be a pruned version of asyncio for some reasons ....