| | |
Import Main problem
Thread Solved |
Hi
My problem today is i have opened up the wxPython Demo and copied one of the pieces of code across to IDLE so i can have a fiddle with it. My problem is that at the start it goes
Any help would be greatly appreciated.
My problem today is i have opened up the wxPython Demo and copied one of the pieces of code across to IDLE so i can have a fiddle with it. My problem is that at the start it goes
from Main import opj . Thats what stuffs it up. The interpreter goes something like this: python Syntax (Toggle Plain Text)
Traceback (most recent call last): File "<pyshell#7>", line 1, in <module> from Main import opj ImportError: No module named Main
Make it idiot proof and someone will make a better idiot.
Check out my Site | and join us on IRC | Python Specific IRC
Check out my Site | and join us on IRC | Python Specific IRC
Is Main a custom module or just inbuilt module? I think you have to check if it is custom and check how to import custom module if it is!
Don't think it will help alot for I have note trie d before
Steve
Don't think it will help alot for I have note trie d before
Steve
Atheist: God is man made imagination, he doesn't exist!
Theist: It's okay, can you imagine anything else that doesn't exist?
Junior MD --- Python, C++ and PHP
Theist: It's okay, can you imagine anything else that doesn't exist?
Junior MD --- Python, C++ and PHP
It is just found in the wxPython demo so it might be a custom thing. I noticed it was to open a file. But when i replaced this:
with this:
It gave me some sort of error where is said it wanted a string or unicode object not a file. So is there any way to open an object (file) and make it a string.
What i want to do with this is have wxPython read from xml files and make a GUI from that. It is in the Demo so i just wanted to do it myself. If you have any pointers for that as well that would be good.
Thanks!
python Syntax (Toggle Plain Text)
text = opj('data.xrc')
python Syntax (Toggle Plain Text)
text= open('data.xrc')
What i want to do with this is have wxPython read from xml files and make a GUI from that. It is in the Demo so i just wanted to do it myself. If you have any pointers for that as well that would be good.
Thanks!
Make it idiot proof and someone will make a better idiot.
Check out my Site | and join us on IRC | Python Specific IRC
Check out my Site | and join us on IRC | Python Specific IRC
Here is a way to open an object file and make it a string
python Syntax (Toggle Plain Text)
text = open('data.xrc').read()
Last edited by Gribouillis; Sep 27th, 2008 at 8:45 am.
If you look into Main.py, you find:
The problem is that the 'wx code demo stuff' is unnecessarily complex on the one side and often very shallow where it counts. It is written by the same guy that wrote the book on wxPython, by all reports a frustrating failure.
python Syntax (Toggle Plain Text)
def opj(path): """Convert paths to the platform-specific separator""" st = apply(os.path.join, tuple(path.split('/'))) # HACK: on Linux, a leading / gets lost... if path.startswith('/'): st = '/' + st return st
Last edited by ZZucker; Sep 27th, 2008 at 9:51 am.
Never argue with idiots, they'll just bring you down to their level and beat you with their experience.
So should i just import that little bit of code into my project to load my xrc files?
Make it idiot proof and someone will make a better idiot.
Check out my Site | and join us on IRC | Python Specific IRC
Check out my Site | and join us on IRC | Python Specific IRC
Oh i also was wondering where do you find the code for such things as that Main module? Is it in the program files?
Make it idiot proof and someone will make a better idiot.
Check out my Site | and join us on IRC | Python Specific IRC
Check out my Site | and join us on IRC | Python Specific IRC
Yeah i ended up finding it in:
C:\Program Files\wxPython2.8 Docs and Demos\demo\
So thats all worked out. Thanks Guys!
C:\Program Files\wxPython2.8 Docs and Demos\demo\
So thats all worked out. Thanks Guys!
Make it idiot proof and someone will make a better idiot.
Check out my Site | and join us on IRC | Python Specific IRC
Check out my Site | and join us on IRC | Python Specific IRC
![]() |
Similar Threads
- Problem Refreshing Picture on JPanel (Java)
- query table to import text file to excel is slow (Visual Basic 4 / 5 / 6)
- Guess Number Game (Problem) (Java)
- problem with TicTacToe..somebody help me!! (Java)
- DrawHouse Code Problem (Java)
- simple program tokenizer problem (Java)
- Compilation problem (Java)
- Memory buttons problem (Java)
Other Threads in the Python Forum
- Previous Thread: Improve scrambled text game
- Next Thread: class in python
| Thread Tools | Search this Thread |
abrupt ansi anti apache approximation array assignment avogadro backend beginner binary bluetooth book builtin calculator character cmd converter countpasswordentry curved customdialog dan08 decimals dictionaries dictionary dynamic error exe file float format function gnu graphics heads homework http ideas import inches input java leftmouse library line lines linux list lists loop module mouse mysqlquery number numbers numeric output parsing path phonebook plugin pointer prime programming progressbar py2exe pygame python random recursion redirect scrolledtext software sqlite statictext statistics string strings sum table terminal text textarea thread threading time tlapse trick tuple tutorial twoup ubuntu unicode urllib urllib2 variable wordgame write wxpython xlib






