| Reply | « Previous Thread | Next Thread » |
|
[config.py]
DeviceName = u"PY_Test" [main.py] from config import * global DeviceName print(u"DeviceName :" + DeviceName) When run main.py on my phone(E65), it throws out an error that DeviceName is not defined. But it works well on PC. |
|
Join Date: Feb 2008
Posts: 2,542
Location: Bhavnagar, Gujarat, India
gaba88
Offline
Forum Nokia Champion
|
|
|
Quote:
please have a look at this article it cn help you a bit. Enjoy Pythoning Gaba88 Gargi Das- http://gargidas.blogsot.com Forum Nokia Python Wiki Learn Python at http://mobapps.org/PyS60 |
|
Hi gaba88,
Thanks for your response. I tried all the methods in that article.They do not work. [code]from config import a[code] [error info]ImportError:cannot import name a |
|
Try without declaring DeviceName as global.
|
|
Join Date: Feb 2008
Posts: 743
Location: Belo Horizonte, Brazil
Rafael T.
Offline
Forum Nokia Champion
|
|
|
Quote:
Try to use this code: Code:
import sys
sys.path.append('E:\\Python')
import extension
variable = extension.a
print variable
BR, Rafael. |
|
Hi,
I still can not import a variable from another module. |
|
Have you tried what I suggested earlier. It worked for me.
|
|
I have tried so. But it does not work. It says 'str' is not defined. Strangely, it does work on my desktop.
[config.py] str = "123" [main.py] import sys sys.path.append('E:\\Python') from config import * print str. |
|
Quote:
Code:
[config.py]
DeviceName = u"PY_Test"
[main.py]
import sys
sys.path.append('E:\\Python')
import config
print DeviceName
|
| Reply | « Previous Thread | Next Thread » |
| Thread Tools | Search this Thread |
|---|---|
| Rate This Thread | |
| Thread | Thread Starter | Forum | Replies | Last Post |
|---|---|---|---|---|
| share variable with images issue | momocha | Mobile Java General | 3 | 2008-11-07 15:28 |
| Strange Compilation error: fatal error: error writing to -: Invalid argument | Evgeniz | General Symbian C++ | 4 | 2007-05-31 08:06 |
| load multiple images using 1 CFbsBitmap variable result in same image | Rx-lee | General Symbian C++ | 1 | 2006-11-15 08:03 |
| Conditional compilation: managing set of modules | doctordwarf | General Symbian C++ | 3 | 2004-08-31 15:01 |
| Modules | stenlik | Symbian Networking & Messaging | 1 | 2004-06-09 10:30 |