Writing a Python App

python

#1

While using Cloud9 IDE, you have access to the Python runtime. Accessing the command is no different than the way you’d use Python on your computer; just open the command line and type python.

Running a Python Program

To run a Python program that you’ve created, you can either:

  • Open the command line and type python, followed by the name of your program; for example python hello_world.py
  • Create a new run scenario, so that you can do things like pass in command line arguments

As a quick demonstration, open a new file, and paste this Python code into it:

#!/usr/bin/python

print "Hello World!";

When you hit the Run button in the menu bar, the console will print out Hello World!.

Python Version

The default Python version used in workspaces is 2.7.6. To use Python3 as your default runner, simply go to your workspace settings then go to Run > Run Configurations > Manage and set Python Version to Python 3.

Or to run a Python program from the command line with Python3 you may just run:
$ python3 filename.py

Python Debugger

Currently there is no built-in Python debugger. Though there is no ETA on this, it will likely be possible in the future. To build a python debugger of your own, check out our SDK documentation.


Tutorials - Table of Contents
Upgrade Python from 2.7 to 3.4 - django runner is using 2.7
#2

When will the python debugger be available?


#3

I’ve updated that section to answer your question now :wink:


#4

To use Python 3 as your default runner, it is not necessary to replace Python 2 with Python 3. Simply use Run / Run Configurations / Manage and set Python Version to Python 3.


#5

Thanks, I’ve updated as you mentioned!


#6

@bradydowling are there any news about a working Python debugger? Thanks!


#7

I’ve heard rumblings of something on this front but I haven’t witnessed anything firsthand. ETA remains TBD :slight_smile:


#8

Please this features is really needed. I will migrate my team (small) from pycharm environment to cloud9 when the it’s ready!


#9

Pssst, try it out now! Official documentation and announcements are still in the works but try it on a new Python workspace and see what happens. Aside from that I’m :zipper_mouth: