[Solved] Problem with Python macro and BasicAddonBuilder
Posted: Sun Aug 30, 2015 2:16 pm
Hello! I am sorry if this is in the wrong spot, I was unsure if this would count as an extensions question, or a python question, because it contains both.
I am have been having some serious trouble working my way through the documentation for Python Macros and Extensions for Open Office, and was wondering if anyone had some beginner-level resources or solutions to some problems I am having with an extension I am working on.
I am using the BasicAddonBuilder 0.5.0 to reduce the number of variables that could be causing things to fail (as it takes care of all the XML and packaging and all that, I just provide the functions and layout of the extension).
Specifically, I am having trouble with the simple act of getting a Python macro to run through the extension. I have copied the basic Hello World code from the sample scripts folder to my extension folder, and have called it in my extension. The extension fully compiles and saves to a .oxt package and can be installed into Open Office, but when I press the menu item, I always get the error:
I have searched for this error, and it seems to be caused by being unable to find the python file or function in question. I am certain, however, that the python file is in the right spot, and that it shouldn't be unable to find the function because I have defined its position to be the right one. The function itself works in the user scripts folder, so I don't believe that that is the problem, so it is either my code for importing the function into the system, or a problem with Basic Addon Builder.
My code for the extension looks like this:
So what am I doing wrong? I am honestly so confused as to what is happening, or what I can do to fix it...
I am have been having some serious trouble working my way through the documentation for Python Macros and Extensions for Open Office, and was wondering if anyone had some beginner-level resources or solutions to some problems I am having with an extension I am working on.
I am using the BasicAddonBuilder 0.5.0 to reduce the number of variables that could be causing things to fail (as it takes care of all the XML and packaging and all that, I just provide the functions and layout of the extension).
Specifically, I am having trouble with the simple act of getting a Python macro to run through the extension. I have copied the basic Hello World code from the sample scripts folder to my extension folder, and have called it in my extension. The extension fully compiles and saves to a .oxt package and can be installed into Open Office, but when I press the menu item, I always get the error:
Code: Select all
A Scripting Framework error occurred while running the Python script vnd.sun.star.script:extension.oxt|PythonFiles|HelloWorld.py$Hello?
language=Python&location=user:uno_packages.
Message: <type 'exceptions.KeyError'>: u'extension.oxt
C:\Program Files (x86)\OpenOffice4\program\pythonscript.py:380 in funtion getStorageUrlFromPersistentUrl() [package = self.mapPackageName2Pathh[ packageName]]
C:\Program Files (x86)\OpenOffice4\program\pythonscript.py:984 in function getScript()
[self.pprovCtx.uriHelper.getStorageURI(scriptUri) );]
My code for the extension looks like this:
Code: Select all
Sub myExtension
' ___________________________________________________________________
beginDescription("NONNAd", "1.2.1")
setLicense("en")
setPublisherName("en", "NONNAd", "http://www.NONNAd.com")
setDisplayName("en", "NONNAd")
setReleaseNotes("en", "http://www.NONNAd.com/notes/ReadMe120.txt")
beginUpdateInformation("direct", "direct")
setUpdateSource("http://www.NONNAd.com/", "http://www.NONNAd.com/") ' first choice
setUpdateSource("http://www.NONNAd.cn/", "http://wwwNONNAd.cn/") ' fallback on another server (optional)
endUpdateInformation
setHelp("en") ' should be after setDisplayName instructions
endDescription
beginAnnexes
endAnnexes
beginAddonUI
beginOfficeMenuBar
beginTitles
setTitle("Authors Aid", "en")
endTitles
beginMenuItems
beginCommand
beginTitles("Writer")
setTitle("Hello World", "en")
endTitles
setURL("Python", "PythonFiles/HelloWorld.py", "HelloWorldPython")
endCommand
endMenuItems
endOfficeMenuBar
endAddonUI