Python will run in Unix, not Windows. How can you run an external python command in terminal?
I am trying to run some code in iPython which
will read in a tsv as a list,
go through it row-by row,
run an external python command on each line,
save the output into a list
append this to our tsv at the end.
My code runs in a Unix environment, but I cannot make it run using iPython and Windows. The external function that I call will also work when called in a windows terminal, but not when called, as below, in an iPython notebook. What have I done wrong? What else can I try?
Here is my code :
import GetAlexRanking #External Method exposed here
import pandas as p
loadData = lambda f: np.genfromtxt(open(f,'r'), delimiter=' ')
with open('list.tsv','rb') as tsvin, open('output.csv', 'wb') as csvout:
tsvin = csv.reader(tsvin, delimiter='\t')
csvout = csv.writer(csvout)
for row in tsvin:
count = 0
url = str([row[count]])
cmd = subprocess.Popen("python GetAlexRanking.py " + url ,shell=True)
cmd_out, cmd_err = cmd.communicate()
cmd_string = str(cmd_out)
print ">>>>>>>URL : " + url + " " + cmd_string #testing
csvout.writerows(url + "\t" + cmd_string) #writing
How can I make this code run using iPython in Windows? It currently gives no error but the cmd_out variable always prints "None" rather than a correct value - the python command isn't being run correctly (however it will work in a normal Python/Unix environment).
Edit: Also runs correctly when ran from Windows terminal.
Is there a way to pass command line arguments to a Perl program you are running from the Padre menu (Run->Run Script)?
I would like to run python files from terminal without having to use the command $ python. But I would still like to keep the ability of using '$ python to enter the python interpreter. For example if
I have a shell script that is sending in about 150 files to a python program I wrote. I have no idea how long it is going to take, so I was wondering if there was a terminal command to either: a) tell
I have a Windows XP machine that has Apache installed via a VisualSVNServer installation. I am . trying to get a simple python cgi script to run in my browser e.g. http://build.procepts.com.au:8080/hg
I know how what to write in a python script to tell a unix box which version of python to run (#!/usr/bin/env python3.2), but how do I do that in windows. I will be deploying a program through distuti
I'm ratheк new to programming, and my question is rather simple: How to run a bunch of code at time that I want? what I mean is simply how to write a programm or a command in Terminal on macOs (I'm us
how can I run multiple commands at once from windows command line? i want to set a couple of env variables and use them in the c++ program. Like: set VAR=Hello and set VAR2=BYE and same program shoul
I want to teach some students basic Python programming without having to teach them how to use the terminal. Recently, I was teaching a 2 hour intro session, and not only did teaching terminal stuff t
I am developing a small web application that requests user input and passes that input as the command line arguments of an external program on the server side machine. public class WorkflowServlet ext
Pretty simple, I'd like to run an external command/program from within a Python script, once it is finished I would also want to know how much CPU time it consumed. Hard mode: running multiple command
Is there a way to control what version of python is run when double clicking on a py file? From the command line and in environments such as eclipse I can control what version is run. But from double
I am doing maintenance for a python code. Python is installed in /usr/bin, the code installed in /aaa, a python 2.5 installed under /aaa/python2.5. Each time I run Python, it use /usr/bin one. How to
I have some .py files I wrote that I want to run on a different machine. The target machine does not have python installed, and I can't 'install' it by policy. What I can do is copy files over, run my
Possible Duplicate: What does <if __name__==“__main__”:> do? Whenever I tried to run my python script in unix nothing would happen. I'd type something along the lines $ python script.py and
My python script is executed via the -m flag: python -m MyPythonModule.MyPhythonModule command_line_arg1 command_line_arg2 However, I can't seem to get to this to work in Eclipse PyDev using the run
I really like using sublime text 2 to write python codes, however any time I try to run a script which has an input, the sublime text console reports an error. So, I decided to try SublimeREPL, howeve
I have configured a keyboard shortcut using xbindkeys to run a python script. Now, while editing any vim file if that user press that keyboard shortcut- I want my python script to run this command to
How can i from a python script emulate user data like: Say i run os.system('grunt init:gruntfile'), and i want the python script automatically to 'enter' some data, so instead of the user inputs the d
I want to run Python code coverage tests for Google App Engine in Eclipse or from command line. Normally Python program required such command line: coverage run program arguments I trying to run it fo
I have the following code snippet, with my question below. As i am completely new to unix, i am not even sure what i should be google searching for to begin with. I know that ./Path is to run a parti
I have a Rails server which will need to run a python script at the background. I know that I can run it like I run terminal commands in ruby, but how is the performance like? is it better to use a py
I am writing a Python code using curses library under Linux. Are there any debugger does not share the same terminal, so I can debug alone with the code running? EDIT: I tried WinPDB, but it works onl
i try run get-vm command on windows powershell. it's throw this exception: Error in script : The term 'Get-VM' is not recognized as the name of a cmdlet, function, script file, or operable program.
I use ubuntu 10.10, and I have both Python 2.x and Python 3.x. I have a program that needs to run with python 3.x (blender 2.5x). How do I run a program with python 3.x?
In a bash shell, I can use 'bash ' or 'source ' to invoke a script by hand. Can I do the similar thing in the Python IDLE's interactive shell? I know I can go to File >> Open Module, then run it
I'm wondering how can I run Symfony 2 command from browser query or from controller. Its because I don't have any possibility on hosting to run it and every cron jobs are setted by admin. I don't even
I need to run file automatically while logging into the system in python on ubuntu.Can anyone guide me to how to create auto run file using python on ubuntu.Thanks in advance.
I'm mucking about with Tkinter and Python. I have a basic gui with a couple of buttons on, one button goes away and does something that takes some amount of time, which is variable. The problem is whe
When I run a command that prompts for input in the minibuffer, it's annoying to have the text overwritten by supposedly helpful messages like: You can run the command 'package-list-packages' with <
I installed SCons 2.2.0 in Python 2.7 on Windows 7. When a run scons from cmd i get the error message scons is not recognized and an internal or external command How can i solve this? The problem
I have an app that needs to run a command in the terminal. or i want to run this command in my app. ssh -N -p 24 -g -D 1080 username@server plz help me . tnx
I have a small script that performs the build and install process on Windows for a bazaar repository I'm managing. I'm trying to run the script with elevated, administrative privileges from within the
I would like to know how I can have a command, or several commands, run at startup every time I start a python interpreter. Is there a way to accomplish this in python, like a .bashrc or .profile file
How can you make a .exe file accessible from any location in the Windows command window? Is there some registry entry that has to be entered?
In linux you can use command & to run command on the background, the same will continue after the shell is offline. I was wondering is there something like that for windows…
I just started programming in Ruby, I would like to know if you can run a command like Sudo python XXX.py I tried to work with RubyPython, but without success because I do not know how and where is
I am currently reproducing the following unix command: cat command.info fort.13 > command.fort.13 in python with the following: with open('command.fort.13', 'w') as outFile: with open('fort.13',
I have a python script that is normally run on a unix machine, I am trying to run it on windows the one snag I have run into is the module syslog. Is there a way that anyone knows that I can get aroun
I want to run unset DISPLAY as a command in the linux terminal, using a Java program. I tried using Runtime.getRuntime().exec(unset DISPLAY);, but it doesn't work. What could I do here?
I'm new in python so my sincere apologies if this is a dum question. I want to trigger, using python, from a linux server a python script run on an windows 7 client. This script get's the mouse pointe
My program runs(exec..) an external program. While running, the external program asks user [Yes/No] to proceed next step. Instead of typing [yes] in command line, how can I pass [Yes] to the external
On some Android device, I only can run echo, cd, ls... this kind of Linux command in adb shell, but when I run tar -cvf //mnt/sdcard/BackUp1669/apk/test.tar /mnt/sdcard/test.apk (or cp etc.)
I have code like: While 1: A = input() print A How long can I expect this to run? How many times? Is there a way I can just throw away whatever I have in A once I have printed it? How does python dea
I have a python program that modifies the configuration file for another program and then invokes that program. The other program uses the configuration file to define a geometry and then apply specif
I understand that to run another Java program from inside a Java program you use something like this: Runtime.getRuntime().exec(/**A command goes here*/) But how would I run a Python program that t
I am trying to run gphoto2 from python but, with no succes. It just returns command not found. gphoto is installed correctly, as in, the commands work fine in Terminal. p = subprocess.Popen(['gphoto2'
I am a PHP developer and am I want to use python for a project. What is the most common and simplest way to run python script on a server like apache or lighttpd? I am having trouble understanding how
So I'm starting like Python a bit, but I'm having trouble erm...running it. Lol I'm using IDLE for now, but its no use whatsoever because you can only run a couple of lines at a time. I'm also using K
How can I run an external program in C? For example application programs like a browser, word, Notepad, etc. Also how can I set a certain size of the window of the external application program? For ex
Does someone know if I have a script one.py which is written the following way: if __name__ == '__main__': # Do something And I want to call that main function from another script. How should I do th