| Reply | « Previous Thread | Next Thread » |
|
Hello,
I'd like to toy around with google's gdata API on my E90 (3rd edition v 07.40.1.2 dated 3-10-2007). I have downloaded the gdata Python API (1.0.10.1) and the required Elementtree library. I have installed my Python interpreter at E:\\Python and in this directory I have the 'elementtree' directory and I have put the 'gdata' directory here as well. I have my code in E:\\Python\Test.py and there I modify the sys.path list to contain the aforementioned directories for gdata and elementtree so I can import them. Then I get the accesspoint so that I can connect to the web. When I run my Test.py via the PED editor the imports work fine, I am asked for my access point, but after selecting one I get KErrPermissionDenied [Errno -46]. I suppose this happens because PED isn't signed for sufficient capabilities for IP access. When I try to run the same script via the standalone Python interpreter, elementtree is imported fine, but gdata is not; I get ImportError: No module named gdata.docs.service Why this difference? Why is ElementTree nevertheless imported properly? The 'gdata' directory has several further subdirectories, 'docs' being one of them, both of them have a file called __init.py__ and there is a file gdata\docs\service.py. I'm not really fluent in Python so I probably don't quite get the module import system. Does the subdirectory structure need to be reflected in the additions to sys.path somehow? I understand that one way of installing Python libraries is to make a .sis out of them, but I don't know how to proceed with something like the gdata library and furthermore I suppose I'd need to install the SDK. This all sounds like a lot of work. Am I on the right track with the sys.path modification approach? I seem to be fairly close of getting this working -- I hope I'm missing something obvious. Is there some other, preferred way of dealing with self-installed libraries? Could PED be tweaked somehow that the interpreter could run with enough rights to use the network? I'm using PED 2.17 final (prints out 'Python 1.4.1 final'). Standalone Python interpreter is 1.4.1. BR, Vesa Here's the relevant code: import sys # Make the interpreter look for the modules in the right place sys.path.append('E:\\Python\elementtree') sys.path.append('E:\\Python\gdata') sys.path.append('E:\\Python\gdata\service') from elementtree import ElementTree # This works ... import gdata.docs.service # ... but this does not import socket # Get the socket access api=socket.select_access_point() apo=socket.access_point(api) apo.start() # Do what you have to do here ... |
|
Hi,
I noted a typing error in my code, I had: sys.path.append('E:\\Python\gdata\service') but it should be sys.path.append('E:\\Python\gdata\docs') and that is what I used to produce the behaviour I saw. The problem still stands. BR, Vesa |
|
Quote:
Quote:
Quote:
Quote:
Quote:
Quote:
It's not clear from your post what the exact contents of the directories are, but given the following structure... Code:
E:\Python\gdata\__init__.py E:\Python\gdata\docs\__init__.py E:\Python\gdata\docs\service.py Code:
import gdata import gdata.docs import gdata.docs.service Code:
import __init__ import docs import docs.service |
|
Hello,
Quote:
Quote:
the sys.path: Code:
sys.path.append('E:\\Python')
I guess I'll look into Ensymble as being able to run things from PED is so much more easier. Thanks for the explanation, Vesa |
| Reply | « Previous Thread | Next Thread » |
| Thread Tools | Search this Thread |
|---|---|
| Rate This Thread | |