Pynotify module : big issue


ekianjo

Hardcore Member
Joined
May 7, 2012
Messages
8,261
Location
神戸市、日本 (Japan)
I am looking for help...


For one of the ports I am working on, there is a requirement for the pynotify module, which is I believe very standard. Apparently it is not included in the firmware, and putting it in a folder of the application does not work either... I get an error: "no module named pynotify".


I tried changing the name just in case but no success at all. The original command is "import pynotify".


Any idea what I should do ??
 

diligentcircle

Well-Known Member
Joined
Aug 29, 2011
Messages
1,594
Age
26
Location
Milky Way galaxy
Website
onpon4.github.io
Is what you're porting a program/script, or a module?


If it's a module, you might have to use the explicit relative import syntax, depending on whether absolute_import is imported from __future__:


from . import pynotify


Another thought: is it called "pynotify", or is it called "pyinotify"? The GitHub page suggests to me the latter, but I'm not on a desktop PC right now, so I can't check.


That's all I can think of at the moment.
 
Last edited by a moderator:

ekianjo

Hardcore Member
Joined
May 7, 2012
Messages
8,261
Location
神戸市、日本 (Japan)
Is what you're porting a program/script, or a module?


If it's a module, you might have to use the explicit relative import syntax, depending on whether absolute_import is imported from __future__:


from . import pynotify


Another thought: is it called "pynotify", or is it called "pyinotify"? The GitHub page suggests to me the latter, but I'm not on a desktop PC right now, so I can't check.


That's all I can think of at the moment.
Porting a program.


The thing is that pynotify module has no pynotify.py inside it... not sure whether that's why it does not find it or not.


And I am not sure if pyinotify is the right one either... i tried to replace pynotify with pyinotify but it comes out with errors as well. Darn...
 

diligentcircle

Well-Known Member
Joined
Aug 29, 2011
Messages
1,594
Age
26
Location
Milky Way galaxy
Website
onpon4.github.io
Alright, I just checked, and yes, it seems it's "pynotify" and it's standard (or standard-ish).


Not having a "pynotify.py" makes perfect sense. The module name is based on what folder it's in. Importation of the module is handled by __init__.py, and the Python script files are individual parts of the module (for example, the pygame module includes pygame.sprite, pygame.mixer, and pygame.locals modules, among others).


So, one last thing to check: is the folder that Pynotify is in called "pynotify" (all lowercase, since case matters in Unix)?
 
Last edited by a moderator:

ekianjo

Hardcore Member
Joined
May 7, 2012
Messages
8,261
Location
神戸市、日本 (Japan)
So, one last thing to check: is the folder that Pynotify is in called "pynotify" (all lowercase, since case matters in Unix)?
I did that, tried to change the name and all, to no avail. I always get "no module named pynotify". Can you try on your side to make a simple python program and import pynotify and see if it works for you ? (on Pandora, not on desktop, since pynotify is included in most desktop distros).
 

diligentcircle

Well-Known Member
Joined
Aug 29, 2011
Messages
1,594
Age
26
Location
Milky Way galaxy
Website
onpon4.github.io
No, not yet. It might be a while.


EDIT: I was trying to download pynotify, but all I can find are pyinotify and py-notify, and neither of these seem to make sense. Could you give a link to where you got it from?
 
Last edited by a moderator:

skeezix

Internal Development
Joined
Mar 11, 2003
Messages
8,062
Website
www.codejedi.com
didn't read thread bnut..


If a module is not included, keep it in your pnd; if its not found like you said, then you may need to add the include path; ie: you can do that in python command line, or in your python code.. ie: your first running app can add more include paths, which can then be used to load subsequent modules.


I do somethig like this:


for p in config.items ( 'PyPath' ):


sys.path.append ( p [ 0 ] )


print "Python module path - adding '", p [ 0 ], "'"
 

skeezix

Internal Development
Joined
Mar 11, 2003
Messages
8,062
Website
www.codejedi.com
All standard python rules apply ..


If its part of the standard library of py, it may or may not be in the pandora; I think the guys who packaged py up for Angstrom broke it out into several packages, and we have some but not all of them in the firmware build. It's been a year or two since I looked, but thats my recollection, could be wrong wtih my sleep dep state :)


Anyway, for import.. you can print the import path, and it'll work; modules havbe rules for import.. perhaps some of the module is included, but not all? or not the module-flag-file in the dir, or something? try debugging it .. it shouldn't be too weird.


If its the case that half the module is present, thats annoying :/ Try bundling it with your pnd, and adding the path as above..


Or is it one of your own modules, and it doesn't work, but others do? If so, debug it, figure out whats up.. it shoudl make sense :)


jeff
 

ekianjo

Hardcore Member
Joined
May 7, 2012
Messages
8,261
Location
神戸市、日本 (Japan)
If its part of the standard library of py, it may or may not be in the pandora; I think the guys who packaged py up for Angstrom broke it out into several packages, and we have some but not all of them in the firmware build. It's been a year or two since I looked, but thats my recollection, could be wrong wtih my sleep dep state :)
Sorry maybe I did not phrase my question well.


What I meant is :


- there are other modules missing for the program I am trying to run, and there is no issue to include them as folders -> python recognizes them.


- for pynotify, this does not work somehow. And this could be well because the module is not the correct one... the command is "import pynotify" in python, but the actual package in the python repositories is called py-notify, and there is another one called pyinotify, and copying their folders (even after renaming them) does not work either. So it may very well be that these are not the right modules...
 

mcobit

Advanced Member
Joined
Jul 28, 2008
Messages
6,910
Did you already have a look, if they are present on the angstrom repo?
 

ekianjo

Hardcore Member
Joined
May 7, 2012
Messages
8,261
Location
神戸市、日本 (Japan)
Did you already have a look, if they are present on the angstrom repo?
Yup. There is libnotify, which is a pre-requisite for pynotify I believe, but not pynotify itself.


There is a python-inotify, but I think that is the NOT same thing as pyinotify - which is not the same thing as pynotify...


EDIT : forgot the NOT, obviously :)
 
Last edited by a moderator:

skeezix

Internal Development
Joined
Mar 11, 2003
Messages
8,062
Website
www.codejedi.com
I'm not as on top of python as I could be but..


py-notify is a pub/sub library, for handling change notifications between objects (perhaps inspirted by QT?)


pyinotify by its name I would assume is an inotify library; inotify is a 'file watch' Linux subsystem; we use it for pnd-files, so we can tell when a pnd file gets changed, we rescan it to see if its an app/etc.


Very different things.


I don't know about 'pynotify'.. ahah, sometimes its called notify-python or python-notify; it is NOT py-notify.. seems like theres a half dozen similarly named packages, and the one you want doesn't seem too well known, so doesn't turn up on the searchs.


I see some references here: http://www.galago-project.org/news/index.php


Maybe you can download it there.


It is _not_ standard python library, but due to name collisions, its very confusing :/


jeff
 

clop

Member
Joined
Aug 17, 2010
Messages
176
Hi,


I checked pynotify on two of my Linux boxes. On one, it was not present at all, on the other one, it was in a sub-folder of gtk-2.0 in the dist-packages folder. When I looked into the "pynotify folder", I saw an __init__.py and a "_pynotify.so" .


As far as I understand this, pynotify is C module for the Python interpreter, and the __init__.py is just here to allow the interpreter to load the C library. Given that we're running on a different arch, that's probably why you can't load directly the x86 module on the Pandora. You will need to cross-compile this module.


Hope that helps,


Clop'
 

ekianjo

Hardcore Member
Joined
May 7, 2012
Messages
8,261
Location
神戸市、日本 (Japan)
Hi,


I checked pynotify on two of my Linux boxes. On one, it was not present at all, on the other one, it was in a sub-folder of gtk-2.0 in the dist-packages folder. When I looked into the "pynotify folder", I saw an __init__.py and a "_pynotify.so" .


As far as I understand this, pynotify is C module for the Python interpreter, and the __init__.py is just here to allow the interpreter to load the C library. Given that we're running on a different arch, that's probably why you can't load directly the x86 module on the Pandora. You will need to cross-compile this module.


Hope that helps,


Clop'
Wow... that makes it much more complicated than I thought if that is really the case...


Thanks a lot for checking!! :)
 

skeezix

Internal Development
Joined
Mar 11, 2003
Messages
8,062
Website
www.codejedi.com
oh, thoguht you knew that -- pynotify that you're looking for, I think is just a wrapper for libnotify or one of those; so the python code is just a stub that in turn loads a native .so and marshals back and forth. (ie: just like how python can use standard-libc functions or many other C libraries.) You dont' want to talk to the library yourself, so pynotify is just a wrapper to do all that to-and-fro'ing for you.


So you definately need the native compiled version of the library (which I think is present), plus any .so adapter layers, plus the pynotify module itself. ie: you need the whole dependancy chain.


(I'd look into it for you, but I don't have time I'm afraid :( ) -- find out what dependnacies there are (on x86 or whatever), and make sure you have them for arm (and preferably built for pandora so the libs all link right.)


jeff
 
Top