Atom - new to it - how to start the code


#1

well i have two IDE up and running

Atom and Pycharm

well since it is fairly easy to start the script in pycharm i think that atom is a bit more tricky.

there is no option to start /& run the code… or did i miss it!?

#!/usr/bin/env python3
"""
contacts.py
This program uses a Person class to keep track of contacts.
"""

class Person(object):
    """
    The Person class defines a person in terms of a
    name, phone number, and email address.
    """
    # Constructor
    def __init__(self, theName, thePhone, theEmail):
        self.name = theName
        self.phone = thePhone
        self.email = theEmail
    # Accesser Methods (getters)
    def getName(self):
        return self.name
    def getPhone(self):
        return self.phone
    def getEmail(self):
        return self.email
    # Mutator Methods (setters)
    def setPhone(self, newPhoneNumber):
        self.phone = newPhoneNumber
    def setEmail(self, newEmailAddress):
        self.email = newEmailAddress
    def __str__(self):
        return "Person[name=" + self.name + \
               ",phone=" + self.phone + \
               ",email=" + self.email + \
               "]"

def enter_a_friend():
    name = input("Enter friend's name: ")
    phone = input("Enter phone number: ")
    email = input("Enter email address: ")
    return Person(name, phone, email)

def lookup_a_friend(friends):
    found = False
    name = input("Enter name to lookup: ")
    for friend in friends:
        if name in friend.getName():
            print(friend)
            found = True
    if not found:
        print("No friends match that term")

def show_all_friends(friends):
    print("Showing all contacts:")
    for friend in friends:
        print(friend)

def main():
    friends = []
    running = True
    while running:
        print("\nContacts Manager")
        print("1) new contact    2) lookup")
        print("3) show all       4) end ")
        option = input("> ")
        if option == "1":
            friends.append(enter_a_friend())
        elif option == "2":
            lookup_a_friend(friends)
        elif option == "3":
            show_all_friends(friends)
        elif option == "4":
            running = False
        else:
            print("Unrecognized input. Please try again.")
    print("Program ending.")

if __name__ == "__main__":
    main()

#2

python3 contacts.py on the terminal.

or use script package


#3

hello - many thanks for the quick answer.
i allready have choosen

script package and
atom-runner

i think that i was able to add those packages but at the moment i am lost…
where to start those !?

i am on windows - but later to night i will try to run all on linux there i have a termianl
btw- on windows i can use as a terminal the cmd-terminal!?


#4

well i guess that i am able to finish the config here… or do i need to do more!?


#5

i cannot open terminal with

ctrl shift & T or with
Alt shift & T

no chance !?
what can i do


#6


Download this package.


#7

( script does not handle input – it is used in the shared Python code.)


#8

Remember that Atom doesn’t have built-in support, except for highlighting and autocompletion, for any specific languages. That has been left to the community, and the package authors generally have not prioritized receiving input as a feature. You may have to look for a different sort of package that will suit your needs if you want input: termination will let you run any terminal command you want without leaving the Atom window.


#9

You should use Script. Go to Settings>>Install>>Script. Then hit “Install”

Now go to your Python file and try Ctrl+Shift+B. No go?

Then open cmd.exe in Windows and type in “py” (no quotes) then Enter. Does a prompt about Python come up or does it say “Command Not Found”? If the latter try typing “python” and Enter. If nothing, you need to reinstall Python on your computer, or Google about getting Python on your PATH.

So if one of them worked, take note. Now go to Atom, on the top bar Packages >> Script >> Configure Script. Then type in the command that worked (like “py” without the quotes) into “Command.” Then hit Run. If that worked, save it as a profile and run that each time.


#10

@suseman wants to run scripts that take input, and script is incapable of that.