Page 1 of 3 123 LastLast
Results 1 to 10 of 21

Thread: Beginning Python - Problem Inputting Text

  1. #1
    Join Date
    Dec 2010
    Location
    Madison, Wisconsin
    Beans
    162
    Distro
    Ubuntu

    Beginning Python - Problem Inputting Text

    I'm new to programming, but have been trying to teach myself python, as I've read that's a good place to start. I'm using IDLE and have tried both 2.6 and 3.1 but I keep running into the same problem. IDLE does not recognize when I type. Sometimes it will work initially, but it will stop letting me type after I run my program. Any help or ideas would be greatly appreciated.

  2. #2
    Join Date
    May 2009
    Location
    Fareham, UK
    Beans
    1,524
    Distro
    Ubuntu 16.04 Xenial Xerus

    Re: Beginning Python - Problem Inputting Text

    Something sounds wrong with your installation of idle, try removing it from software centre and reinstalling, if not, are you able to type in other windows/text editors??
    Catch me on Freenode - imark

  3. #3
    Join Date
    Oct 2010
    Location
    Rio de Janeiro, Brasil
    Beans
    32
    Distro
    Ubuntu 11.04 Natty Narwhal

    Re: Beginning Python - Problem Inputting Text

    purge idle
    Code:
    sudo apt-get purge idle-python2.6
    then install it again.
    are there any error messages? can you be more specific about the issue? Look, sometimes you are not able to open idle (2.6) more than once.

  4. #4
    Join Date
    Nov 2007
    Location
    Wisconsin
    Beans
    1,139

    Re: Beginning Python - Problem Inputting Text

    Idle opens a 'Python Shell' window that shows you *results*. That's why you can't type much. You can type on the bottomost '>>>' prompt, but that's not where you do your work.

    Select File -> New Window to create a window you can create programs in.
    To test your program, save it (CTRL+S), then run it (F5)...and see the reults in the original 'Python Shell' window.

  5. #5
    Join Date
    Dec 2010
    Location
    Madison, Wisconsin
    Beans
    162
    Distro
    Ubuntu

    Re: Beginning Python - Problem Inputting Text

    Thanks for the replies, but my problems seem to have multiplied. I purged IDLE, and then reinstalled 3.1.3. Now, I can type in the shell, but whenever I open a new window, I cannot type. Further more, in the shell, when I try to run a very basic command, for example:

    print "hello world! "

    I get the following error:

    print "hello, world! "
    SyntaxError: invalid syntax

    and it is highlighting the closing quotation mark. I also tried using ' ' but had the same result. Please help! I am really interested in learning to program but this start does not seem very auspicious.

  6. #6
    Join Date
    Dec 2010
    Location
    Madison, Wisconsin
    Beans
    162
    Distro
    Ubuntu

    Re: Beginning Python - Problem Inputting Text

    Sorry, ignore the error part of the previous post. I just figured out that apparently in python 3 "print" is a function and must be excecuted like:

    print("hello world! ")

  7. #7
    Join Date
    May 2010
    Beans
    90
    Distro
    Ubuntu 10.10 Maverick Meerkat

    Re: Beginning Python - Problem Inputting Text

    Quote Originally Posted by zhogan85 View Post
    Thanks for the replies, but my problems seem to have multiplied. I purged IDLE, and then reinstalled 3.1.3. Now, I can type in the shell, but whenever I open a new window, I cannot type. Further more, in the shell, when I try to run a very basic command, for example:

    print "hello world! "

    I get the following error:

    print "hello, world! "
    SyntaxError: invalid syntax

    and it is highlighting the closing quotation mark. I also tried using ' ' but had the same result. Please help! I am really interested in learning to program but this start does not seem very auspicious.
    EDIT: Jeez you beat me to it glad to see you figured it out

    Python 3 has slightly different syntax for certain things that can become confusing if you're used to Python 2.x

    For instance, print is no longer a statement in Python 3 but a function. try:

    Code:
    print("Hello, World!")

  8. #8
    Join Date
    Dec 2010
    Location
    Madison, Wisconsin
    Beans
    162
    Distro
    Ubuntu

    Re: Beginning Python - Problem Inputting Text

    Thanks for the quick reply theweeksleep. Since I'm just learning I don't have the older syntax ingrained in me yet, so I'll stick with the latest version.

    OK, so after trying several different versions of IDLE, I now have 3.1.3. When I opened a new window, it let me type, but when I went to run the program, i lost the ability to type when trying to type a file name to save it and from then on I cannot type in IDLE without restarting IDLE. I can still type fine in every other program, and have never had a similar problem.

  9. #9
    Join Date
    Sep 2005
    Location
    Rural Nevada, USA
    Beans
    314
    Distro
    Ubuntu 17.04 Zesty Zapus

    Re: Beginning Python - Problem Inputting Text

    Quote Originally Posted by zhogan85 View Post
    Thanks for the quick reply theweeksleep. Since I'm just learning I don't have the older syntax ingrained in me yet, so I'll stick with the latest version.

    OK, so after trying several different versions of IDLE, I now have 3.1.3. When I opened a new window, it let me type, but when I went to run the program, i lost the ability to type when trying to type a file name to save it and from then on I cannot type in IDLE without restarting IDLE. I can still type fine in every other program, and have never had a similar problem.
    I can't help you with the IDLE problem. I recently started using Geany for Python editing, and I find it is a nicer application.

    Congratulations for starting right out with Python 3. Lots of people are still recommending the 2.xx series, but I think if you want to get started and start right, go with the latest version. The libraries and other apps will catch up soon enough, and by the time you've mastered the language there will be plenty of support at hand.

  10. #10
    Join Date
    Sep 2010
    Beans
    62

    Re: Beginning Python - Problem Inputting Text

    Quote Originally Posted by zhogan85 View Post
    Any help or ideas would be greatly appreciated.
    Code:
    #!/usr/bin/env ruby
    puts "hello world"
    Code:
    $ ruby -e 'puts "hello world"'

Page 1 of 3 123 LastLast

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •