Ask Your Question

python uno. '' object has no attribute 'requestRestart'

asked 2020-06-19 20:55:21 +0200

vlad.bezugliy gravatar image

Hi all. I need to restart office after changing UI language (so as real application behaves). So I found XRestartManager ( which has requestRestart method I wanted to try.

But, when I run following code:

            import uno
            restart_manager = uno.getClass("")()

I have got

AttributeError: '' object has no attribute 'requestRestart'

Maybe there are some another way to perform app restart. Any advices might be helpfull. Thank you!

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted

answered 2020-06-19 23:04:38 +0200

Jim K gravatar image

Use the component context to get the singleton.

ctx = XSCRIPTCONTEXT.getComponentContext()
restartManager = ctx.getValueByName(
if not restartManager.isRestartRequested(False):

According to, it didn't use to restart. But it works now, so the full implementation must have been added at some point.

edit flag offensive delete link more


Thank you, OfficeRestartManager instantiated and worked properly in this way.

vlad.bezugliy gravatar imagevlad.bezugliy ( 2020-06-20 09:36:42 +0200 )edit

@Jim K

Hi, looking to call a restart from a base form after user completes an input box. Not familiar with Python, how can I do this with a basic macro ? Thanks for your thoughts

gkick gravatar imagegkick ( 2021-02-08 05:10:31 +0200 )edit
Jim K gravatar imageJim K ( 2021-02-08 11:47:07 +0200 )edit

@Jim K Thanks for the link

gkick gravatar imagegkick ( 2021-02-08 15:48:48 +0200 )edit
Login/Signup to Answer

Question Tools

1 follower


Asked: 2020-06-19 20:55:21 +0200

Seen: 118 times

Last updated: Jun 19 '20