https://bugs.documentfoundation.org/show_bug.cgi?id=163404

--- Comment #6 from Werner Tietz <[email protected]> ---
(In reply to vibrationoflife from comment #4)

> I have patched just for the fix and NO FORMATTING.
> https://gerrit.libreoffice.org/c/core/+/174877

Your so called »patch« doesnt make a difference…the traceback with original
pythonscript.py:
__________________________________________________________

---------------------------------------------------------------------------
com.sun.star.uno.DeploymentException      Traceback (most recent call last)
Cell In[4], line 2
      1 from pythonscript import PythonScriptProvider as psp
----> 2 userpackages = psp(XSCRIPTCONTEXT.ctx, "user:uno_packages")
      3 userpackages

File /usr/lib/libreoffice/program/pythonscript.py:1009, in
PythonScriptProvider.__init__(self, ctx, *args)
   1007 text = lastException2String()
   1008 log.debug( "PythonScriptProvider could not be instantiated because of :
" + text )
-> 1009 raise e

File /usr/lib/libreoffice/program/pythonscript.py:1000, in
PythonScriptProvider.__init__(self, ctx, *args)
    997 self.provCtx = ProviderContext(
    998     storageType, sfa, urlHelper, ScriptContext(
uno.getComponentContext(), doc, inv ) )
    999 if isPackage:di
-> 1000     mapPackageName2Path = getPackageName2PathMap( sfa, storageType )
   1001     self.provCtx.setPackageAttributes( mapPackageName2Path , rootUrl )
   1002     self.dirBrowseNode = PackageBrowseNode( self.provCtx, LANGUAGENAME,
rootUrl )

File /usr/lib/libreoffice/program/pythonscript.py:842, in
getPackageName2PathMap(sfa, storageType)
    839     ret = {}
    840     packageManagerFactory = uno.getComponentContext().getValueByName(
    841         "/singletons/com.sun.star.deployment.thePackageManagerFactory"
)
--> 842     packageManager = packageManagerFactory.getPackageManager(
    843         mapStorageType2PackageContext(storageType))
    844 #    packageManager.addModifyListener( ModifyListener() )
    845     log.debug( "pythonscript: getPackageName2PathMap start
getDeployedPackages" )

com.sun.star.uno.DeploymentException: null process service factory at
./comphelper/source/processfactory/processfactory.cxx:79
________________________________________________________


and the traceback with the patch:
_____________________________________________________

---------------------------------------------------------------------------
com.sun.star.uno.DeploymentException      Traceback (most recent call last)
Cell In[3], line 2
      1 from pythonscript import PythonScriptProvider as psp
----> 2 userpackages = psp(XSCRIPTCONTEXT.ctx, "user:uno_packages")
      3 userpackages

File /usr/lib/libreoffice/program/pythonscript.py:1009, in __init__(self, ctx,
*args)
   1007         storageType = content.getIdentifier().getContentIdentifier()
   1008     except Exception:
-> 1009         text = lastException2String()
   1010         log.error( text )
   1012 isPackage = storageType.endswith( ":uno_packages" )

File /usr/lib/libreoffice/program/pythonscript.py:1000, in __init__(self, ctx,
*args)
    998     if storageType.startswith( "vnd.sun.star.tdoc" ):
    999         doc = getModelFromDocUrl(ctx, storageType)
-> 1000 else:
   1001     inv = args[0]
   1002     try:

File /usr/lib/libreoffice/program/pythonscript.py:842, in
getPackageName2PathMap(sfa, storageType)
    833         ret = "user"
    834     return ret
    836 def getPackageName2PathMap(sfa, storageType):
    837     # com.sun.star.deployment.thePackageManagerFactory is deprecated.
    838     #
    839     # This method works fine when called after LibreOffice is started;
    840     # however, it fails when called during the startup of LibreOffice.
    841     #
--> 842     # Both ExtensionManager and thePackageManagerFactory have the same
issue in this case.
    843     #
    844     # The error message is:
    845     # null process service factory at
./comphelper/source/processfactory/processfactory.cxx:79
    846     # args: (null process service factory at
./comphelper/source/processfactory/processfactory.cxx:79,)
    847     # typeName: 'com.sun.star.uno.DeploymentException'
    848     # value: null process service factory at
./comphelper/source/processfactory/processfactory.cxx:79
    849     #
    850     # see also:
https://bugs.documentfoundation.org/show_bug.cgi?id=163404
    851     # This was discover when I was working on "ooo-development-tools"
(OooDev).
    852     # OooDev can also start LibreOffice via the command line and run a
script.
    853     # If this script calls PythonScriptProvider(ctx,
"share:uno_packages") it will get the error above.
    854     # The workaround for OooDev is here:
https://github.com/Amourspirit/python_ooo_dev_tools/blob/main/ooodev/uno_helper/py_script/python_script.py
    855     # Notably the big difference is that OooDev used it ctx that was
created during the startup of LibreOffice.
    856     # Example usage is can be seen here:
https://github.com/Amourspirit/python_ooo_dev_tools/blob/main/ooodev/uno_helper/importer/importer_shared_script.py
    857     #
    858     # Summary:
    859     #   This method works fine when called after LibreOffice is
started.
    860     #   thePackageManagerFactory is deprecated.
    861     #   ExtensionManager works as expected and is the only really
change in this method.
    863     ret = {}
    865     ext_mgr = uno.getComponentContext().getValueByName(
    866         "/singletons/com.sun.star.deployment.ExtensionManager"
    867     )

com.sun.star.uno.DeploymentException: null process service factory at
./comphelper/source/processfactory/processfactory.cxx:79
_______________________________________________


ps. both the original and the patch works without Exception if the code is
executed from »apso-python-console«

-- 
You are receiving this mail because:
You are the assignee for the bug.

Reply via email to