Writing Python scripts in terminal

Discussion in 'MacBook Pro' started by doctorabyss, Nov 24, 2010.

  1. doctorabyss macrumors newbie

    Joined:
    Nov 24, 2010
    #1
    I cannot figure out how to write a script in the terminal, specifically, python.
    Any help would be appreciated, thanks
     
  2. gibbz macrumors 68030

    Joined:
    May 31, 2007
  3. hayduke macrumors 65816

    hayduke

    Joined:
    Mar 8, 2005
    Location:
    is a state of mind.
    #3
    I think you'll also have to make the file executable.

    man chmod
     
  4. doctorabyss thread starter macrumors newbie

    Joined:
    Nov 24, 2010
    #4
    eee, that's a tad too complex for me atm, but thank you.
    There are no simpler ways?

    Oh, I just noticed hayduke's reply.
    I'll try that. thanks!
     
  5. uMBPi728 macrumors member

    Joined:
    Nov 19, 2010
    Location:
    Glendale, Ca and Berkeley
    #5
    Dashcode

    Why not use an editor such as Dashcode. That's what I use for editing PY files. Dashcode is part of the XCode developer tools package located on your OS Install Disk.

    Once installed go to /Developer/Applications folder, open Dashcode.

    This is all you need to do some pretty cool stuff with Python on the mac.

    Mel
     
  6. doctorabyss thread starter macrumors newbie

    Joined:
    Nov 24, 2010
    #6
    bah, this is my boyfriends computer, my mbp needs to have a new screen installed, and he tossed out his install disk, so I can't DL dashcode without paying 99 bucks :/
     
  7. uMBPi728 macrumors member

    Joined:
    Nov 19, 2010
    Location:
    Glendale, Ca and Berkeley
    #7
    Check...

    To see if you have the upgrade disk for Leopard or Snow Leopard, because XCode install is on there too.
     
  8. Molecule macrumors regular

    Joined:
    May 19, 2010
    #8
    You could also just use TextEdit and save the files as .py...

    Or you could run python in interactive mode - go into Terminal and type 'python'.


    On a side note, I thought you only had to pay $99 if you wanted fancy stuff...I thought you could sign up and download XCode for free. I could be mistaken though.




    Molecule :apple:
     
  9. uMBPi728 macrumors member

    Joined:
    Nov 19, 2010
    Location:
    Glendale, Ca and Berkeley
    #9
    Yeah, it's a free download but it's a hefty download at that. See XCode.

    Good point, textedit would be the next best thing but terminal is kinda clunky to use, I didn't like it. Dashcode is my preferred editor, its free. :)
     
  10. doctorabyss thread starter macrumors newbie

    Joined:
    Nov 24, 2010
    #10
    I have no discs, at all...
    Yeah, I guess I'll just be using text editor for the meantime...
    I do run python with the terminal currently, but I am only aware of how to do statements, not full scripts...
    also, I don't believe you can save anything in terminal as a script.

    To download it from the internet, you need to register as an Apple Developer, which requires a $99 fee.

    Nevermind- it looks like through the link you provided, it is free.
    Thanks!
    I'll see if my boyfriend minds the DL
     
  11. uMBPi728 macrumors member

    Joined:
    Nov 19, 2010
    Location:
    Glendale, Ca and Berkeley
    #11
    If the download is too big, let me know...I could send you the 98MB DashCode file. Just PM if u're interested.

    Mel
     
  12. Molecule macrumors regular

    Joined:
    May 19, 2010
    #12
    Uh...TextEdit doesn't run in the Terminal - It has a GUI.
     
  13. jlw2387 macrumors member

    Joined:
    Nov 13, 2010
    #13
    I think the $99 fee is only when you are going to distribute applications. Xcode itself is free.
     
  14. uMBPi728 macrumors member

    Joined:
    Nov 19, 2010
    Location:
    Glendale, Ca and Berkeley
    #14
    I don't think I implied that it does run in terminal, if it seemed that way, sorry should've articulated my thoughts better, only that it's the next logical choice to use as an editor if she didn't mind not using terminal. :rolleyes:
     

Share This Page