| Reply | « Previous Thread | Next Thread » |
|
Hello,
I wanted to test the possibility of extending PyS60 with C++ so i tried to make a simple example (inspired from uikludges example). I have no problems with building the files, pyd, sis and signing themm but when i try to install on the phone i get this error: Unable to install. Mass memory not available. I also managed to build, sign and install the uikludges example and it works fine. Can anyone help please? here's the code i'm using: mySquare.cpp: Code:
#include <e32std.h>
#include <e32base.h>
#include "Python.h"
#include "symbian_python_ext_util.h"
#include "logger.h"
static PyObject* mySquare_getSquare(PyObject*, PyObject *args)
{
TInt number;
TInt square;
if (!PyArg_ParseTuple(args, "i", &number))
return NULL;
square = number * number;
return Py_BuildValue("i", square);
}
static const PyMethodDef mySquare_methods[] =
{
{"getSquare", (PyCFunction)mySquare_getSquare, METH_VARARGS},
{0, 0} /* Sentinel */
};
DL_EXPORT(void) init_mySquare()
{
PyObject* module = Py_InitModule("_mySquare", (PyMethodDef*) mySquare_methods);
}
#ifndef EKA2
GLDEF_C TInt E32Dll(TDllReason)
{
return KErrNone;
}
#endif
mySquare.py Code:
import _mySquare
import e32
def getSquare( number ):
_mySquare.getSquare(number)
#: Exported functions from this module
__all__ = ["getSquare"]
# Export all E*** pseudo constants automatically
for x in locals().keys():
if x.startswith("E"):
__all__.append(x)
Code:
TARGETTYPE dll UID 0x20033AE3 0xE7777777 TARGET _mySquare.pyd TARGETPATH \sys\bin NOSTRICTDEF EXPORTUNFROZEN SYSTEMINCLUDE \epoc32\include SYSTEMINCLUDE \epoc32\include\libc USERINCLUDE . USERINCLUDE \epoc32\include\python LIBRARY python222.lib LIBRARY euser.lib LIBRARY avkon.lib LIBRARY flogger.lib LIBRARY eikcore.lib LIBRARY cone.lib LIBRARY ws32.lib LIBRARY estlib.lib library eikcoctl.lib library efsrv.lib MACRO __DO_LOGGING__ SOURCE mySquare.cpp #ifdef EKA2 CAPABILITY LocalServices Location NetworkServices PowerMgmt ProtServ ReadDeviceData ReadUserData SurroundingsDD SwEvent TrustedUI UserEnvironment WriteDeviceData WriteUserData #endif mySquare.pkg Code:
;
; mySquare dll install
;
;Languages
&EN
;Localised Vendor name
%{"Sabin"}
;
;
#{"mySquare"},(0x20033AE3),1,0,0
;
;Supports Series 60 v 2.0
;
[0x101F7961], 0, 0, 0, {"Series60ProductID"}
;
; Files to install:
"_mySquare.pyd" -"X:\mySquare\_mySquare.pyd"
"mySquare.py" -"X:\mySquare\mySquare.py"
|
|
any help? so basicaly my example is a stripped down example of uikludges... i can't figure out what's with that error. any help is apreciated !
|
|
Seems your phone has less memory? is it?
On which device are you installing ? Kandyfloss V 7.0642.0 18-10-06 RH-51 Nokia 7610 |
| kandyfloss |
| View Public Profile |
| Find all posts by kandyfloss |
|
oh, i forgot to mention that: the phone is a N95 8GB... and all memory is free...
still didn't figure the problem out. can someone please try to see if the above example compiles and works on other phones? any help would be very much apreciated. thank you |
|
Hi,
I don't have time to check this now but you could try replacing the X's with !'s in these lines in the pkg file: Code:
"_mySquare.pyd" -"X:\mySquare\_mySquare.pyd" "mySquare.py" -"X:\mySquare\mySquare.py" Code:
"_mySquare.pyd" -"!:\mySquare\_mySquare.pyd" "mySquare.py" -"!:\mySquare\mySquare.py" Sorcery |
| Sorcery-ltd |
| View Public Profile |
| Find all posts by Sorcery-ltd |
|
I think that with the "X" I just specify the path from where to include the files in the .sis (I
Code:
subst x: c:\symbian Nevertheles i will give it a try. EDIT: It worked, the sis installed succesfully! But now i get the "ImportError: No moduled named mySquare" error. I will look into this, thanks a lot ! EDIT2: It seems i was making a really stupid mistake. Replaced the last 2 lines in the .pkg with this: ; Files to install: "_mySquare.pyd" -"c:\sys\bin\_mySquare.pyd" "mySquare.py" -"c:\resource\mySquare.py" to install the module in the right place All works well now, I can import the module and call it's getSquare method but it returns the value of "None".
Last edited by sstoica : 2008-04-04 at 16:24.
|
| Reply | « Previous Thread | Next Thread » |
| Thread Tools | Search this Thread |
|---|---|
| Rate This Thread | |
| Thread | Thread Starter | Forum | Replies | Last Post |
|---|---|---|---|---|
| Simple tutorial needed | selimhanov | Tools and SDK Feedback | 6 | 2008-01-08 12:49 |
| [announce] s60 Simple libs wrapper 0.1 | cyke64 | Python | 0 | 2007-05-24 14:56 |
| Simple HTTPS Request Gone Wrong | roryfynn | Mobile Java Networking & Messaging & Security | 3 | 2006-01-30 11:15 |
| Simple game do NOT imply simple solution... | etamburini | Mobile Java General | 3 | 2005-04-28 15:32 |
| Simple game do NOT imply simple solution... | etamburini | Mobile Java Media (Graphics & Sounds) | 3 | 2005-04-04 16:29 |