Results 1 to 6 of 6

Thread: How do I get perl/python programs to run?

  1. #1
    Join Date
    Aug 2008
    Beans
    8

    How do I get perl/python programs to run?

    I've been trying to get a perl and a python program to run. When I click on them, it opens in kate etc. How do I make them use perl/python? Using Ubuntu 13.04.

    Thanks
    Bill

  2. #2
    Join Date
    Jan 2009
    Location
    ::1
    Beans
    2,485

    Re: How do I get perl/python programs to run?

    Quote Originally Posted by linsol View Post
    I've been trying to get a perl and a python program to run. When I click on them, it opens in kate etc. How do I make them use perl/python? Using Ubuntu 13.04.

    Thanks
    Bill
    Start the file browser Nautilus, go to the directory containing the python file ".py". Then right click somewhere in that folder but NOT on a file, and click on "Open in terminal". That will open a (black) terminal. Type "python <filename>.py" and press enter.

  3. #3
    Join Date
    Apr 2013
    Beans
    12

    Re: How do I get perl/python programs to run?

    You need to change the file's permission to be executed:
    Code:
    chmod +x /path/to/file
    If that's not enough, the first line of your program needs a correct interpreter chosen. Example for python:
    Code:
    #!/usr/bin/python
    
    #rest of your code

  4. #4
    Join Date
    Jan 2009
    Location
    ::1
    Beans
    2,485

    Re: How do I get perl/python programs to run?

    Quote Originally Posted by anoldone View Post
    You need to change the file's permission to be executed:
    Code:
    chmod +x /path/to/file
    If that's not enough, the first line of your program needs a correct interpreter chosen. Example for python:
    Code:
    #!/usr/bin/python
    
    #rest of your code
    Are you sure?

    Code:
    sander@flappie:~$ ll testing.py
    -rwxrwxr-x 1 sander sander 35 May 20 18:37 testing.py*
    sander@flappie:~$ cat testing.py
    #!/usr/bin/python
    
    print "Hello!"
    
    sander@flappie:~$
    ... but the default app in Nautilus is ... "Text Editor".
    So it would also need changing the default handler to python ...

  5. #5
    Join Date
    Aug 2007
    Location
    FL
    Beans
    139
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: How do I get perl/python programs to run?

    I think what is happening is that your file browser think you want to edit it. See if you can right-click on the file, select Open with Other application and then select python/perl.

    You can also create an icon/tab/something in your menu that when clicked will run the file for you.

    Is this how you want to run those programs (double-clicking on them)?

  6. #6
    Join Date
    Aug 2008
    Beans
    8

    Re: How do I get perl/python programs to run?

    Thanks, I had to do it from a terinal. Wouldn't do it in a file manager.

    Bill

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
  •