Error:- tensorboard: command not found . However, while typing locate tensorboard, I am getting the the location - python-2.7

I am a beginner in tensorflow. I ran a simple script as below :
import tensorflow as tf
a =tf.constant(2)
b = tf.constant(3)
c = tf.add(a,b)
with tf.Session() as sess:
writer = tf.summary.FileWriter('./graphs',sess.graph)
print sess.run(c)
writer.close()
After saving this python file, I ran it in terminal. There is folder graphs created with 2 events file. Then I ran following command on terminal :
tensorboard --logdir="./graphs"
I am getting following error:
tensorboard: command not found
Please help. Thanks in advance.
​

As you mentioned you are getting tensorboard location, try to run your command with your local path, ex
/your/path/tensorboard --logdir="./graphs"
Hope this will help you, happy coding

Related

Entering a command to an opened Command Prompt window with python script

I have been trying enter couple of commands on a command window with python script. I was able to open the .exe file by checking the other questions.
However, now my code:
import os
os.chdir(r'filepath')
os.system("start /B start filepath\application.exe")
opens the application and it asks for an input file name, then it will ask for output file name. Is there a way to do that. This will be used for ArcGIS so it needs to be done in python 2.7.
I checked all related questions but did not find the answer. I would appreciate it very much if you could help.
Finally! It was easier than I thought but I needed lots of research. This code for python 2.7 which may differ for other versions.
import os
import subprocess
os.chdir(r'filepath')
subprocess.check_call([r"filepath\your_.exe_app", 'your_input'])

No Module named ESPN_Scraper.items

I am learning python and am trying to run the code on this github project.
https://github.com/rcfbanalysis/rcfbscraper
When I try to run a command such as the following
python "C:\Python\rcfbscraper-master\ESPN_Scraper\ESPN_Scraper\spiders\espnSpider.py"
I get the error No Module named ESPN_Scraper.items.
This is the offending line
from ESPN_Scraper.items import GameItem
From what I can tell is ESPN_Scraper items.py is not in your sys path. one quick work around for this would be to put the ESPN_Scraper directory in the same directory as your espnspider.py file.
Take a look at the docs https://docs.python.org/2/tutorial/modules.html section 6.1.2

How to run executable with input file using Python?

I am running an executable from cmd:
*.exe input.inp
I want to run it using python and tried following:
os.system('"*.exe"')
But don't know how to specify input file as well. Any suggestions?
import os
from subprocess import Popen, PIPE
p = Popen('fortranExecutable', stdin=PIPE) #NOTE: no shell=True here
p.communicate(os.linesep.join(["input 1", "input 2"]))
For more please refer to:
Using Python to run executable and fill in user input
I had to launch cmd window and specify input file location from within Python script. This page was really helpful in getting it done.
I used Popen(['cmd', '/K', 'command']) from above page and replaced '/K' with '/C' in it to run and close the cmd window.
import os
os.system(r'pathToExe.exe inputFileOrWhateverOtherCommand')

python import cx_Oracle error in command window

I'm having trouble running some codes that import cx_Oracle in command line, though the same codes work in console. Is there anything else I will need to set up in order to get this to work via command line please?
Saved just one line of code "import cx_Oracle" as test.py.
Run this line in ide (Spyder), iPython Notebook => no issues
run this by opening a command line window from the same folder the .py file is saved in, and run python test.py and encounter the below:
import cx_Oracle
ImportError: DLL load failed: %1 is not a valid Win32 application.
Not sure if there is anything additional I will need to set up to run cx_Oracle via command line? Have tried all the suggestions on setting PATH, ORACLE_HOME, re-installing but could not get this to work. versions that i'm using are
Python: 2.7
cx_Oracle: cx_Oracle-5.1.3-11g.win-amd64-py2.7
instant client: 12.1.0.0
Windows: 7 Enterprise
I also found this kind of problem.
Look at "not a valid Win32 application" this sentence, so I decide to change cx_Oracle to cx_Oracle-5.1.3-11g.win-32-py2.7. Luckly, it does work.

ubuntu cannot run any programs

I'd like to start by saying that I'm new to SO. Please let me know if I am not following the site's conventions.
I've just installed Ubuntu 14.04 (duel booting with Windows 8), and am trying to install CUDA, but noticed that trying to run programs via ./ yields errors. As a test, I wrote a quick python script:
if __name__=='__main__':
print 'hi'
and tried to run it from terminal. Calling it via python foo.py works fine, but ./foo.py from the same directory causes
line 3: syntax error: unexpected end of file.
This is the same error I get when trying to execute CUDA's .run file. Am I doing something extremely ignorant, or is it possible that some library is missing?