Sublime Text 3 files not opening in command line/powershell - python-2.7

I’ve just finished Codecademy and am setting up Python (2.7) and Sublime Text 3 on my own computer using the Codecademy guide page. I can successfully perform simple operations (eg. Print “Hello world”) a) in Python and b) by using ctrl+b on text in my Sublime Text 3 editor page, which gives the output in the box at the bottom of the page.
I’m stuck/confused when it comes to running the Sublime Text 3 file through the command line and confused on the powershell vs. command line issue (I’m running Windows 10).
My command line does not display the $ sign in the codecademy page example (https://www.codecademy.com/articles/setup-python), so should I be entering the commands below through Powershell rather than the command line? If so, I don’t get the $ in Powershell either.
If I carry on regardless and try to change directories etc through Command Prompt or Powershell, I only get error messages and can't seem to run the Sublime Text 3 file.
I’m also not clear on whether this is an issue about which directory I’m in. Running dir in both the Command prompt and Powershell returns the result: after I’ve opened Python, but lists all subfolders of C:\Users\my_name if I run it before opening Python. Does this mean that I need to save my Sublime Text files in some sort of subfolder of Python in order to be able to run them as above?
Or does it not matter that I’m not able to run the Sublime Text 3 files through Python directly and I should just stick to doing so through Sublime Text 3 itself? Will this limit me later on?
Thanks for your help
BC89

Related

the program just keeps on taking input in sublime text terminal window [duplicate]

This question already has answers here:
Can't send input to running program in Sublime Text
(5 answers)
Closed 2 years ago.
I use Sublime Text 2 but it won't let me enter any value when my code asks for user input. (In other words: input() in Python and gets in Ruby fail to correctly prompt me for input).
Python throws an EOFError error (what you get when user doesn't enter anything).
Simply USER INPUT isn't working in Sublime Text 2 for me.
EDIT: FOR EXAMPLE
try:
text = input('Enter something: ')
print text
except EOFError:
print('\nEOFError')
=> Enter something: #cannot enter anything to var "text"
=> EOFError
=> [Finished]
Sublime text doesn't support that. But you can get around it (at least in python) by using SublimeREPL, I use this for everything, it works pretty great. Its a little cooky though, as the tab is still editable like a normal sublime tab (which is good and bad)...
It also allows you to run the interpreter in multiple tabs, its basically awesome.
To install it you need package control this lets you easily install plugins. To get it go here, and follow the instructions. Once thats done:
in Sublime press ctrl + shift + P (linux command in ST for 'goto anything').
Type in 'install',
click on 'sublime package control: install package'.
Then select SublimeREPL. It will install it automatically.
To use it go to Tools>sublimerepl>python from the menus.
To make the default build system SublimeREPL, you can follow these instructions.
Since, Sublime not directly support for input console. So, it is easy to get input in Sublime with following extra steps:
Make sure that you have install Package control in Sublime.
If you have no install Package control then, go to here then, click install Now button (top right) copy those code and paste it in your Console (make sure you have tick the Show Console option) and Press Enter. (after that restart sublime)
Go to ->Command Palette(Cltr + Shift + p) click "Package Control: Install Package"
Search : "SublimeRepl" and wait for Installing.
Once, it is Installed, ,Restart Sublime
Go to Tools you will see ""SublimeRepl" option at the bottom (which indicates that it is successfully installed in your sublime)
To run python scripts: Go to Tools->SublimeRepl->Python->Python-RUNcurrentfile option and your code is run in new Repl Tab.
Note: This works fine for sublimeText3 (windows )

Coldfusion Plugin In Sublime text

I just moved from ColdFusion Builder to Sublime Text 3 and now I want to add the ColdFusion plug-in into my Sublime. I have googled it and found one solution that says to add the "Package Control.sublime-package " file to the installation package folder and then restart Sublime.
I did this but am not able to find a "restart" option in Sublime. Due to this I am not getting any changes on my Sublime, regarding ColdFusion.
There is no restart button. Just close and re-open sublime.
edit:make sure you are opening the file as a coldfusion file. In the bottom-right corner of sublime, it says what file type is being considered. Changing this to CFML may be your solution.
edit2: removed some bad instructions that were confusing and incorrect
It may help someone else ...
Open the command palette ( CTRL + SHIFT + P on Windows, CMD + SHIFT + P on a Mac) and select Package Control: Install Package . Wait for the list to open and find the CFML entry (subtitled with this github repo github.com/jcberquist/sublimetext-cfml ), then select it to install. Restart Sublime Text 3.

subprocess.Popen unexpected behavior

I inherited some Python code which uses subprocess.Popen to print a pdf file using Adobe Reader. The code has worked well for years running on Windows 7, I am getting it set up on Windows 10. For some reason the call to Popen starts an Adobe Reader process, but does not open the application. The code works as expected if I run it from the Python interpreter. But when it when it is running as a Windows process, Adobe Reader does not open, or print the pdf. I checked the command line parameters for the running process and it is invoked exactly the same as when run from the Python Interpreter. A code snippet is below.
printFileName = r'"C:\Program Files\Adobe\Reader 9.0\Reader\AcroRd32.exe" /p /h /t '
printFileName = printFileName + filename
subprocess.Popen(printFileName)
filename is the full path to a .pdf file.
I'm not really sure where to even begin figuring this out so any pointers or suggestions on how to improve the question would be appreciated.

command prompt appears than immediately disappears

I encountered this problem after following a python tutorial on Youtube about creating text files. The instructor had us type in the following code to start:
def createFile(dest):
print dest
if__name__ == '__main__':
createFile('ham')
raw_input('done!')
We had created a folder on the desktop to store the file 'ham' in. But when I double clicked on 'ham' the command prompt window popped on then in a flash it popped off. I am an obvious beginner and I don't know what is going on. Can anyone explain this to me?
You can open command prompt then navigate to python interpreter
directory and run your program by typing python /diretory/to/your/program.py for
example if you have a program named test.py in the directory c:/python and you want to
run it and you have python interpreter installed in C:/python2.x/ directory
then you should open command prompt and type in
cd c:\python2.x\
then you should type
python c:/python/test.py
and perfectly it will work
showing you your program output .

starting program via command line arguments

I'm trying to start a program via the command line. I am working out of section 8.5: Command Line Arguments in C++ for Everyone. I built the program in netbeans.
How do I start the program from the command line? I am not sure where to find the program. I was expecting to find an .exe in the Documents\NetBeansProjects folder that I could run with the arguments, but I could not find one.
I am on windows 7.
Thanks!
**Where does Netbeans output the C++ executable?
(in addition, I may or may not be able to figure out how to run it once I find it. ~never used cmd line before)
Alternatively, you can press [Win]+R and type/select cmd. For me, that's the fastest way.
There probably is some terminal under your OS. Try typing the full path of the executable in it.
To get a terminal, select start --> run --> enter cmd and press OK.
If "explorer" is still part of Windows 7, use that to search for the file. You can (or used to be able to run) explorer by pressing and holding the Windows key and then pressing the e key. From there, you can cd to the appropriate directory and enter the file name on the command line.