Page 1 of 2 12 Last
  • Jump to page:
    #1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2005
    Location
    temporarly: Rosetown, Sk (Canada)
    Posts
    22
    Rep Power
    0

    Help with starting python


    Hey
    I just decided to try python as a first and a half language (i learned QBasic), and I downloaded a verson (2.4) from python.org. The problem is, that I just don't have a clue how to run it. It would be very nice if you guys could help me a little.
    THANKS
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Nov 2003
    Posts
    624
    Rep Power
    34
    Generally, install it as appropriate for your operating system (run the EXE on Windows and follow the setup). I will assume Windows, because that's what I use .

    When it is installed, you can go to start -> programs -> Python 2.4 -> Idle (Python GUI) and get straight to the interactive prompt.

    This is Python. You can type code and it will run as you press enter - it's great for exploring, testing and playing around.

    Try it out now - open IDLE and type something like:

    Code:
    >>> print "hello world!"
    then

    Code:
    >>> for x in range(10):
    ...     print x
    Next, if you know some QBasic you might be comfortable playing around for a bit. Quick tips:

    Code:
    >>>     - the interactive prompt. You don't type this.
    
    # a comment
    mytext = "something"    #make a string
    mynumber = 4    # make an integer
    mylist = []         # make a list
    help(mylist)               # get help on something - e.g. lists
    dir(mystring)          # What can mystring do?
    Or find some tutorial to follow along with... I found this Bruce Eckel's Tutorial rather good.

    When you want to write complete scripts or programs, you can do so in IDLE (file -> new window opens a basic text editor) or from any other text editor you like, and save it with .py as the file extension. Then run your saved script by double-clicking on it in Windows Explorer, or from the command line with "python myscript.py".

    I hope you enjoy Python.
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2005
    Location
    temporarly: Rosetown, Sk (Canada)
    Posts
    22
    Rep Power
    0
    Thanks.
    But there is already the next problem...
    I am clicking on IDLE (Python GUI), and nothing happens.
    I could run something though by tiping "python" in the "Run" bar in the start menu. Is that the same thing?
    winkler
  6. #4
  7. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2003
    Posts
    186
    Rep Power
    0
    Originally Posted by awinkler
    Thanks.
    But there is already the next problem...
    I am clicking on IDLE (Python GUI), and nothing happens.
    I could run something though by tiping "python" in the "Run" bar in the start menu. Is that the same thing?
    winkler
    did you try using the python command line version?
    it should be a link in the same general area as you IDLE(python gui)

    try using Python(Command LIne) tell me what happens
  8. #5
  9. No Profile Picture
    Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Nov 2003
    Posts
    624
    Rep Power
    34
    I could run something though by tiping "python" in the "Run" bar in the start menu. Is that the same thing?
    It's the same Python interpreter, but the command line version instead of the GUI version, so it's uglier and has a lot less editing ability.

    I am clicking on IDLE (Python GUI), and nothing happens.
    That's not good. Have you tried uninstalling and reinstalling Python?
    Windows 95/98/ME or Windows NT/2000/XP?

    To work out what the problem is, you could try:
    start -> run -> cmd.exe -> OK
    change directory to the idle folder, wherever Python is
    installed and try running it...

    Code:
    c:\documents and settings\username> cd\
    c:\> cd python24\lib\idlelib
    c:\python24\lib\idlelib\>python idle.py
    If it loads, that's good, if it just errors out, can you post what it says?
  10. #6
  11. Mini me.
    Devshed Novice (500 - 999 posts)

    Join Date
    Nov 2003
    Location
    Cambridge, UK
    Posts
    783
    Rep Power
    13
    If your machine is Windows XP based then the problem may be security related...

    IDLE uses Internet style communication to send info between its windows.

    This means that if you have a firewall (in my case McAfee) on a Windows XP machine with Service pack 2 you can have problems

    You can test if this is your problem by opening a command shell and typing the following:

    C:\.....>cd c:\python24
    C:\Python24>python lib\idlelib\idle.py

    If the program tries to run but displays lots of text with errors about not being able to use sockets then the problem is a firewall problem.

    My first attempt at a solution was to configure the firewall to allow the operation of Python and IDLE.

    My second attempt was to disable firewall protection (both XP and McAfee).

    My third attempt was to remove the McAfee firewall completely.
    This worked!

    I have managed firewalls on many machines but it seems that XP + Service Pack 2 + third party firewall is not a good combination. I suspect that if I had installed service pack 2 after installing all the apps (it was new machine) I would have had more luck.

    I suppose I should now re-install the firewall but my laptop works behind two other firewalls and life is toooo short

    grimey
  12. #7
  13. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2005
    Location
    temporarly: Rosetown, Sk (Canada)
    Posts
    22
    Rep Power
    0
    Originally Posted by sfb
    That's not good. Have you tried uninstalling and reinstalling Python?
    Windows 95/98/ME or Windows NT/2000/XP?
    I got XP. Why?

    Originally Posted by sfb
    To work out what the problem is, you could try:
    start -> run -> cmd.exe -> OK
    change directory to the idle folder, wherever Python is
    installed and try running it...

    Code:
    c:\documents and settings\username> cd\
    c:\> cd python24\lib\idlelib
    c:\python24\lib\idlelib\>python idle.py
    If it loads, that's good, if it just errors out, can you post what it says?
    It said after the seconfd line :"The system cannot find the path specified". Whatever that means.
  14. #8
  15. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2005
    Location
    temporarly: Rosetown, Sk (Canada)
    Posts
    22
    Rep Power
    0
    Originally Posted by Grim Archon

    C:\.....>cd c:\python24
    C:\Python24>python lib\idlelib\idle.py
    Type it in under "cmd.exe"... If I do it there I have an error after the first line... "Cannot find specified path"
    If it is a firewall-problem, is there an other possibility than deinstalling the firewal?? Because I do NOT have two others, and this is not even my own computer...
  16. #9
  17. No Profile Picture
    Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Nov 2003
    Posts
    624
    Rep Power
    34
    Originally Posted by awinkler
    I got XP. Why?
    Oh, just wondering if there was something about Windows 95/98 that might cause problems.

    It said after the seconfd line :"The system cannot find the path specified". Whatever that means.
    Hmm. I'm at a bit of a loss what to suggest to you that wont involve a thousand troubleshooting steps.

    You don't need Idle to use Python, you can (as you found earlier) just run it in plain text mode and it will work.

    You obviously have it installed, but it can't find the path c:\python24, so maybe you chose another drive or folder during the install?

    To avoid more troubleshooting, you could download and install the Python Windows Extensions (pywin32-2.04.win32-py2.4.exe). They come with another nice interactive shell and editor called PythonWin, and I haven't heard of that having problems with the XP firewall.
  18. #10
  19. Mini me.
    Devshed Novice (500 - 999 posts)

    Join Date
    Nov 2003
    Location
    Cambridge, UK
    Posts
    783
    Rep Power
    13
    Originally Posted by awinkler
    Type it in under "cmd.exe"... If I do it there I have an error after the first line... "Cannot find specified path"
    If it is a firewall-problem, is there an other possibility than deinstalling the firewal?? Because I do NOT have two others, and this is not even my own computer...
    So it looks like Python has not been installed in the standard location - so where did you choose to install it?
    If you right-click on the IDLE menu item in the Start menu and select properties it will tell you where on the computer it thinks Python has been installed to.

    All the instruction we have given you so far have assumed the default directory - you can use them but you must change the directory you use the CD command to be the one specified in the "Start in:" field of the IDLE (Python GUI) Properties window.

    If you cannnot mess with the machine then as has been said - you don't have to use IDLE, any text editor will do.

    grimey
    Last edited by Grim Archon; January 15th, 2005 at 07:42 PM.
  20. #11
  21. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2005
    Location
    temporarly: Rosetown, Sk (Canada)
    Posts
    22
    Rep Power
    0
    Ok. Thanks for all the help. I finally got it running. I just deinstalled it and reinstalled it in a different directory. Now it works. Why, I do not know.
    Thanks again
  22. #12
  23. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2005
    Location
    temporarly: Rosetown, Sk (Canada)
    Posts
    22
    Rep Power
    0

    Just another Newbie Question


    I have a little problem with the Python IDLE. Is there any way, that I can change the lines, without hitting return and running the prograam? Its because I am used to running a program as a whole, and I find it sort of annoying, that everytime I give the program something else than a def-statement, it just runs the program. Tell me if I am wrong, but it does not seem to me like I can write programs like that which are longer than 5-10 lines of code...
  24. #13
  25. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2005
    Location
    temporarly: Rosetown, Sk (Canada)
    Posts
    22
    Rep Power
    0
    I just found the newbie Forum...
    If any Moderator reads this, could he move it there?? I figure that it is in a mor apropriate place there...
  26. #14
  27. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2004
    Posts
    461
    Rep Power
    24
    Originally Posted by awinkler
    I have a little problem with the Python IDLE. Is there any way, that I can change the lines, without hitting return and running the prograam? Its because I am used to running a program as a whole, and I find it sort of annoying, that everytime I give the program something else than a def-statement, it just runs the program. Tell me if I am wrong, but it does not seem to me like I can write programs like that which are longer than 5-10 lines of code...
    Your right, that does suck, so this is what you do. You create a file called foo.py and with something like notepad. Then you execute it with cmd.
  28. #15
  29. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2005
    Location
    temporarly: Rosetown, Sk (Canada)
    Posts
    22
    Rep Power
    0
    Originally Posted by CyBerHigh
    Your right, that does suck, so this is what you do. You create a file called foo.py and with something like notepad. Then you execute it with cmd.
    Ok, so it is not just me... But it would be nice, if you could give me a more detailed decription of what to do.
Page 1 of 2 12 Last
  • Jump to page:

IMN logo majestic logo threadwatch logo seochat tools logo