| Reply | « Previous Thread | Next Thread » |
|
Hi
I am writnig .Pyd(DLL) code. (using Symbian S60 3rd edition FP1 and Pys60 1.9.5). I attached .py file. From this file i call .pyd file. When i click on "Call DLL" from option menu emulator display panic KERN EXCE 3. Please help me where i am doing mistake? Please. Code:
#include <e32std.h>
#include <e32cmn.h>
#include <stdio.h>
#include <stdlib.h>
#include <Python.h>
#include <symbian_python_ext_util.h>
#define MODULE_NAME sdk12graphics //:ulwp COMP_NAME
#define MODULE_NAME_STRING "sdk12graphics" //:usp COMP_NAME.inspect
#define MODULE_INIT_FUNC initsdk12graphics //:ulwp 'init' + COMP_NAME
static PyObject *sdk12graphics_InitControlL(PyObject *self, PyObject *args);
static int InitControlL(TPtrC& aUrl);
static int InitControlL(TPtrC& aUrl)
{
return 1;
}
static PyObject *sdk12graphics_InitControlL(PyObject *self, PyObject *args)
{
TInt error;
char* b;
int l;
if (!PyArg_ParseTuple(args, "u#", &b, &l))
{
//Py_INCREF(Py_None);
return SPyErr_SetFromSymbianOSErr(error); //Py_None;
}
TPtrC aUrl((TUint16*)b, l);
return Py_BuildValue("i",InitControlL(aUrl));
}
static const PyMethodDef sdk12graphics_methods[] =
{
{"initializecontroll", (PyCFunction)sdk12graphics_InitControlL, METH_VARARGS, "Returns a CObject with a CFbsBitmap*"},
{NULL, NULL} /* sentinel */
};
#define METHOD_TABLE const_cast<PyMethodDef*>(&sdk12graphics_methods[0])
extern "C" {
DL_EXPORT(void) MODULE_INIT_FUNC(void)
{
// Add extra initialization here
PyObject* module = Py_InitModule(MODULE_NAME_STRING, METHOD_TABLE);
if (!module)
{
return;
}
}
}
#ifndef EKA2
GLDEF_C TInt E32Dll(TDllReason)
{
return KErrNone;
}
#endif
Code:
TARGET _pythondll.pyd TARGETTYPE dll UID 0x1000008d 0xEE402E33 #ifdef EKA2 CAPABILITY NetworkServices LocalServices ReadUserData WriteUserData UserEnvironment #endif USERINCLUDE ..\inc SYSTEMINCLUDE \epoc32\include SYSTEMINCLUDE \epoc32\include\libc SYSTEMINCLUDE \epoc32\include\python TARGETPATH \system\libs nostrictdef LIBRARY euser.lib LIBRARY fbscli.lib LIBRARY estlib.lib LIBRARY python_appui.lib LIBRARY python222.lib LIBRARY python25.lib LIBRARY estlib.lib /* Necessary only if you use the C standard library */ LIBRARY apgrfx.lib LIBRARY eikcore.lib LIBRARY ws32.lib LIBRARY cone.lib #ifdef ENABLE_ABIV2_MODE DEBUGGABLE_UDEBONLY #endif SOURCEPATH ..\src SOURCE PythonDLL.cpp SymbianTH
Last edited by SymbianTH : 2009-07-03 at 13:33.
Reason: Forget attach a File
|
|
Hi
I put my File in following path: _pythondll.pyd : C:\Symbian\9.2\S60_3rd_FP1\Epoc32\winscw\c\sys DetectSymbian : C:\Symbian\9.2\S60_3rd_FP1_4\Epoc32\winscw\c\Data\python My .Pyd File Code is: Code:
from graphics import *
import appuifw
import e32
class BabelFishUI(object):
def __init__(self):
self.__lock = e32.Ao_lock()
self.__img = Image.new((176, 144))
self.__language = 'it_en'
self.__textUI = None
appuifw.app.exit_key_handler = lambda:self.__lock.signal()
appuifw.app.title = u'BabelFish v1.0'
appuifw.app.body = self.__canvas = appuifw.Canvas(redraw_callback=self.updateScreen)
appuifw.app.menu = [(u'Translate', lambda:self.__translateUI()), (u'Call DLL', lambda:self.__CallDLL()), (u'About', lambda:appuifw.note(u'BabelFish: v1.0", "Created by\nWhite Tiger\n<Z-TEAM@Libero.it>', 'info')), (u'Exit', lambda:self.__lock.signal)]
self.updateScreen(None)
self.__menuMain = appuifw.app.menu
self.__bgMain = appuifw.app.body
self.__lock.wait()
def updateScreen(self, rect):
self.__canvas.blit(self.__img)
.
.
.
def __CallDLL(self):
if e32.pys60_version_info > (1,9):
# PyS60 1.9.x and above
appuifw.note(u"1.9.x")
else:
# Pys60 1.4.x or below
appuifw.note(u"1.4.x")
#appuifw.note(u'CallDLL", " Now write code for call Symbian DLL', 'info')
if e32.s60_version_info>=(3,0):
# Symbian 9.0 way to import things
import imp
_pythondll=imp.load_dynamic('_pythondll', 'c:\\sys\\_pythondll.pyd')
else:
# Old way
import _pythondll
.
.
.
</BabelFishUI>
if __name__ == '__main__':
BabelFishUI()
|
|
This panic is raised when completing an outstanding request to a logical channel; the panic occurs when the request number is invalid. Specifically, the panic occurs in a call to the Complete() member function of a DLogicalChannel.
Try making a standalone which calls the pyd and test on a real device. This panic is raised in debug builds only. --NirpSis http://sites.google.com/site/nirpsis/ http://nirpsis.blogspot.com/ |
|
Since you are developing an extension for PyS60 1.9.6, you should not link against `python222.lib`. Remove this entry from the MMP file. Also, wondering why you need to link against `python_appui.lib`.
|
| mahesh.sayibabu |
| View Public Profile |
| Find all posts by mahesh.sayibabu |
|
Also, the PYD name should be in a specific format: kf_<module_name>.pyd
For example, if your module name is `sdk12graphics', the pyd name in the mmp file should be as follows: .MMP file Code:
TARGET kf_sdk12graphics.pyd |
| mahesh.sayibabu |
| View Public Profile |
| Find all posts by mahesh.sayibabu |
|
Quote:
Thank you for your response. I tested in Nokia E71x (3rd edition FP1) attached application code(example.sisx). I do that way which you suggest me look in example application but now give me an error named: "example=imp.load_dynamic('example','C:\\sys\\bin\\kf_example.pyd") ImportError:dlopen:Load failed" Please help me again. Regards, SymbianTH |
|
1. example.c, replace these lines
Code:
DL_EXPORT(void) initexample(void) {
Py_InitModule("example", example_methods);
}
Code:
DL_EXPORT(void) initexample(void) {
Py_InitModule("_example", example_methods); //note the change in module name, basically it is better to name pyd and its wrapper (.py file) with different names.
}
Code:
TARGET kf_example.pyd TARGETPATH \system\libs Code:
TARGET kf__example.pyd // kf_<module_name>.pyd => kf__example.pyd // TARGETPATH \system\libs // Remove this entry, the pyd will be created in \epoc32\release\<platform>\<build>\ Code:
if e32.s60_version_info>=(3,0):
import imp
example=imp.load_dynamic('example', 'c:\\sys\\bin\\kf_example.pyd')
else:
import example
Code:
import _example Take a look at the example code of a simple extension module, elemlist present under extras\elemlist of PyS60 source tree. |
| mahesh.sayibabu |
| View Public Profile |
| Find all posts by mahesh.sayibabu |
|
Quote:
Thanks for give me snippets and for your help. I have done all change as you told me but than also do not work this. When i type on interactive script >> import _example give me error like this name module not find in python25\python25.zip\... i tried with all commands like >> import _example >> import kf__example >> import __example but gives me same error. I tested on N73 also. Rgards, SymbianTH |
|
Strange!
'import _example' should have worked. Hope the PYD is packaged and installed on the device. Try to compile and import elemlist module, present under extras\elemlist of PyS60 source tree. If this works, then you can easily modify it and add the functionality that you want your module to do. |
| mahesh.sayibabu |
| View Public Profile |
| Find all posts by mahesh.sayibabu |
|
Quote:
import antigravity |
| ashwinurao |
| View Public Profile |
| Find all posts by ashwinurao |
| Reply | « Previous Thread | Next Thread » |
| Thread Tools | Search this Thread |
|---|---|
| Rate This Thread | |
| Thread | Thread Starter | Forum | Replies | Last Post |
|---|---|---|---|---|
| View server panic with 11 on draw | raj_rr7 | Symbian User Interface | 7 | 2009-05-18 12:36 |
| KERN EXEC 3 on device not on Epoc | Kavit Patel | General Symbian C++ | 4 | 2008-11-21 16:02 |
| Rfile and saving image file received in MHFRunL() of socket.. kern exec 0 panic | sanee | Symbian Networking & Messaging | 14 | 2008-11-03 10:14 |
| 求助!显示GIF格式图像时出现 KERN EXEC 15的错误!急! | allenliujiansong | Symbian | 2 | 2008-10-29 04:49 |
| KERN EXEC 3 ERROR | sanjayks84 | Symbian User Interface | 3 | 2008-05-28 10:13 |