[Tutor] problem adding Tkinter
I apologize in advance for asking such a simple question! I first tried looking through Google, and through the last couple months of this list's archives, and I found some talk about my issue out there but not a detailed enough answer to help someone as new as me. This is my first programming language, so most explanations of this stuff go way over my head! [This is my problem:] I've been using IDLE successfully to do very very simple exercises in Python, and now I wanted to start on some very simple exercises including the Tkinter library. But it looks like it's not set up right and I don't know how to do what I need to do to adjust.. whatever needs to be adjusted. I did the tests listed here: http://wiki.python.org/moin/TkInter I failed at step 2: - Step 2 - can Tkinter be imported? Try the following command at the Python prompt: >>> import Tkinter # no underscore, uppercase 'T' * If it works, go to step 3. * If it fails with "No module named Tkinter", your Python configuration need to be changed to include the directory that contains Tkinter.py in its default module search path. You have probably forgotten to define TKPATH in the Modules/Setup file. A temporary workaround would be to find that directory and add it to your PYTHONPATH environment variable. It is the subdirectory named "lib-tk" of the Python library directory (when using Python 1.4 or before, it is named "tkinter"). -- I could do import _tkinter but not import Tkinter This is what I received back from the Shell: >>> import _tkinter >>> import Tkinter Traceback (most recent call last): File "", line 1, in import Tkinter ImportError: No module named Tkinter >>> Unfortunately, the instructions they gave on what to do if Step 2 fails read like Greek to me. I don't know what a PYTHONPATH is, I don't remember doing anything with a Modules/Setup file, and I don't know what an environment variable is, or what to do with subdirectories. I am running Windows XP. Installed Python 3.1, and IDLE seems to be working okay... When I go to C:\Python31 I see these folders: DLLs Doc include Lib libs tcl Tools There are 3 .exe files: python.exe pythonw.exe w9xpopen.exe I see something called _tkinter.lib in the folder C:\Python31\libs There is a folder called tkinter inside the folder Lib (C:\Python31\Lib\tkinter) Would someone be able to spell out to me in every detailed steps exactly what I should do, assuming I know pretty much nothing about programming or installing a programming language, so that when I put import Tkinter it doesn't error? Thank you very much for reading! -Kristin ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] problem adding Tkinter
SORRY TO ALL: PLEASE DISREGARD MY LAST EMAIL. I kept searching through the Tutor archives and found an answer in the Feb archives. (In Python 3 you have to type tkinter in all lower case.) Thanks all, Kristin On Fri, Oct 30, 2009 at 5:21 PM, Kristin Wilcox wrote: > I apologize in advance for asking such a simple question! I first > tried looking through Google, and through the last couple months of > this list's archives, and I found some talk about my issue out there > but not a detailed enough answer to help someone as new as me. > > This is my first programming language, so most explanations of this > stuff go way over my head! > > [This is my problem:] I've been using IDLE successfully to do very > very simple exercises in Python, and now I wanted to start on some > very simple exercises including the Tkinter library. But it looks like > it's not set up right and I don't know how to do what I need to do to > adjust.. whatever needs to be adjusted. > > I did the tests listed here: http://wiki.python.org/moin/TkInter > > I failed at step 2: > - > Step 2 - can Tkinter be imported? > > Try the following command at the Python prompt: > >>>> import Tkinter # no underscore, uppercase 'T' > > * If it works, go to step 3. > * If it fails with "No module named Tkinter", your Python > configuration need to be changed to include the directory that > contains Tkinter.py in its default module search path. You have > probably forgotten to define TKPATH in the Modules/Setup file. A > temporary workaround would be to find that directory and add it to > your PYTHONPATH environment variable. It is the subdirectory named > "lib-tk" of the Python library directory (when using Python 1.4 or > before, it is named "tkinter"). > -- > I could do import _tkinter but not import Tkinter > > This is what I received back from the Shell: >>>> import _tkinter >>>> import Tkinter > Traceback (most recent call last): > File "", line 1, in > import Tkinter > ImportError: No module named Tkinter >>>> > > > Unfortunately, the instructions they gave on what to do if Step 2 > fails read like Greek to me. I don't know what a PYTHONPATH is, I > don't remember doing anything with a Modules/Setup file, and I don't > know what an environment variable is, or what to do with > subdirectories. > > I am running Windows XP. Installed Python 3.1, and IDLE seems to be > working okay... > > When I go to C:\Python31 I see these folders: > DLLs > Doc > include > Lib > libs > tcl > Tools > > There are 3 .exe files: > python.exe > pythonw.exe > w9xpopen.exe > > I see something called _tkinter.lib in the folder C:\Python31\libs > There is a folder called tkinter inside the folder Lib > (C:\Python31\Lib\tkinter) > > Would someone be able to spell out to me in every detailed steps > exactly what I should do, assuming I know pretty much nothing about > programming or installing a programming language, so that when I put > import Tkinter it doesn't error? > > Thank you very much for reading! > > -Kristin > ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
[Tutor] CGI Script Fails on import cgi
Hello, As I've mentioned on the list before, I'm very new to Python and programming in general. Now I'm trying my hand at writing very very simple CGI scripts. I basically wanted to try play with cgi scripting as I feel my way around Python. I'm uploading to my account on my university's server. Unfortunately, I error out whenever I do 'import cgi'. I'm hoping to receive some advice! Thanks in advance for reading all this. Facts: 1. From what I can tell, the server is Red Hat Enterprise Linux with Apache 1.3.33. 2. I have successfully executed .cgi scripts that only included printing text or html. 3. I've tried adding form validation with cgi.FieldStorage() and it would run in the server command line okay as .py, without syntax errors. 4. However, these same scripts including cgi.FieldStorage() would fail to execute when uploaded as a cgi script. I get this error: "CGI Script Failure The web page you attempted to access seems to have a problem: the script failed before sending any headers. " 4. I tested by adding only 'import cgi' to one of my html printing files that worked, to confirm that it was the sole problem. That script failed - so I knew the module import was it. 5. I then used try: import cgi, except: traceback.format_exc(None) I received this: Traceback (most recent call last): File "cgi_errors.cgi", line 9, in import cgi File "/usr/local/depot/python.1250025008/lib/python2.6/cgi.py", line 40, in import urllib File "/usr/local/depot/python.1250025008/lib/python2.6/urllib.py", line 26, in import socket File "/usr/local/depot/python.1250025008/lib/python2.6/socket.py", line 46, in import _socket ImportError: ld.so.1: python: fatal: relocation error: file /usr/local/depot/python.1250025008/lib/python2.6/lib-dynload/_socket.so: symbol inet_aton: referenced symbol not found 6. From the command line I typed python2.6, and then asked for sys.path, sys.modules["cgi"], sys.modules["socket"], and sys.modules["urllib"], and sys.modules["_socket"] and this is what it gave me: '/usr/local/depot/python.1250025008/lib/python26.zip', '/usr/local/depot/python.1250025008/lib/python2.6', '/usr/local/depot/python.1250025008/lib/python2.6/plat-linux2', '/usr/local/depot/python.1250025008/lib/python2.6/lib-tk', '/usr/local/depot/python.1250025008/lib/python2.6/lib-old', '/usr/local/depot/python.1250025008/lib/python2.6/lib-dynload', '/usr/local/depot/python.1250025008/lib/python2.6/site-packages', '/afs/umbc.edu/common/python26/i386_linux26/lib/python2.6/site-packages' Any advice would be much appreciated! - Kris ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
[Tutor] module name completion suggestions drop down?
Hello, I was wondering about something I've seen in people's video tutorials -- these people are using IDLE like I am, but they get these drop down suggestions for module names that I'm not experiencing. The user starts typing a built-in method and suggestions of possible methods that start with those characters drop down at their cursor. The user is not in the Shell - they're in the edit window thingy. I have attached a screen print showing what I'm talking about, in case I'm describing this too vaguely. Do any of you know something about this --> Is there a setting I don't have switched on? Or is there something I can download? I've done a bunch of google searches, but came up empty. (possibly I just don't know the right terminology to search for) FYI: I am running Windows XP, and have python 2.6 and 3.1 installed, with wxPython installed on 2.6 Thanks for your help! -kris <>___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Should a beginner learn Python 3.x
I started as an absolute beginner to with programming with Python 3. I remain a beginner but I've now installed 2.6 as well, because I found that some of the modules I wanted to use weren't available for 3.x. My personal experience was that the available literature/tutorials wasn't really a problem. I quickly figured out that I should copy the list on the python site of all the 2x-3x changes, and I picked up a couple other lists written with different wording saying the same thing, and kept it as a quick reference on my computer. But honestly, as a beginner you only run into a handful of differences. Other than print(), input(), <>, xrange(), the dictionary has_key, interkeys(), a bit of other dictionary stuff, tkinter, and renamed http modules, you're not going to run into much that varies between the versions. I just learned the very basic stuff to watch out for - compared to all the other new knowledge you're putting in your brain, it's nothing. I personally really prefer print() to print - it just made more sense to me when learning, and I like that you get a set literal like you get with lists and dictionaries (it felt like the same logic was being applied in similar situations, which is good when you're just starting out). But these are small conveniences and I switched to 2.x because of compatibility issues. I don't think it's a problem to initially learn on 3.1, but I do think it's inevitable that he will have to learn both - and not just for compatibility with the cool toys. If he's going to be using random online tutorials and reading references from everywhere, he's going to run into stuff written for both 3.x and 2.x and he's going to have to know the little differences to compensate for when trying out the practice code. For instance, 2.x users that grab the new Head First Programming book by O'Reilly that's coming out in Dec (teaching beginning programming using Python 3.1) will have issues converting backwards.. so it's not all one way. Just my mostly ignorant 2 cents. -Kris On Sat, Nov 14, 2009 at 12:49 PM, Stephen Nelson-Smith wrote: > My brother in law is learning python. He's downloaded 3.1 for > Windows, and is having a play. It's already confused him that print > "hello world" gives a syntax error > > He's an absolute beginner with no programming experience at all. I > think he might be following 'Python Programming for the Absolute > Beginner", or perhaps some online guides. Should I advise him to > stick with 2.6 for a bit, since most of the material out there will > be for 2.x? Or since he's learning from scratch, should he jump > straight to 3.x In which case what can you recommend for him to work > through - I must stress he has absolutely no clue at all about > programming, no education beyond 16 yrs old, but is keen to learn. > > S. > > -- > Stephen Nelson-Smith > Technical Director > Atalanta Systems Ltd > www.atalanta-systems.com > ___ > Tutor maillist - Tutor@python.org > To unsubscribe or change subscription options: > http://mail.python.org/mailman/listinfo/tutor > ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor