w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
Command works in command line but gives 'no such file or directory' in bash script
Remove the quotes around line 8. Like this: ./optAlg.exe "$inputFile" 500 2>&1 > "output/$outputFile" By placing quotes around the whole line you tell bash to execute a command which is called exactly ./optAlg.exe $inputFile 500 2>&1 > output/$outputFile and of course there is no such command. In reality you want to run ./optAlg.exe with parameters. Do not forget to place quotes around the variables because otherwise filenames that have whitespace characters are going to be passed as several arguments. Please read about arguments. And you can read about common pitfalls as well.

Categories : Bash

How to open a window from the command line within a Python script?
You can use subprocess module. subprocess is a newer way to spawn processes rather than using os.spawn*() or os.system(). In your case: import subprocess subprocess.Popen(["ds9"]) This should run ds9 in background. See the documentation here.

Categories : Python

How do I run Python script using arguments in windows command line
To execute your program from the command line, you have to call the python interpreter, like this : C:Python27>python hello.py 1 1 If you code resides in another directory, you will have to set the python binary path in your PATH environment variable, to be able to run it, too. You can find detailed instructions here.

Categories : Python

Android FFMPEG command line for video filter
Your ffmpeg build is too old to support the curves video filter with presets. Presets were added on 2013-03-25 (lavfi/curves: add presets support) bumping libavfilter to version 3.48.103. You will need to update your ffmpeg.

Categories : Android

Why does python's recursive copy not work the same as on the command line?
Seems os.system changes the shell it executes in to sh: mike@mike-VirtualBox:~/head$ echo $0 bash mike@mike-VirtualBox:~/head$ python Python 2.7.3 (default, Apr 10 2013, 06:20:15) >>> import os >>> os.system("echo $0") sh When the copy command is executed via Popen with a bash shell, it works as expected: >>> import subprocess >>> sp.Popen("cp -rf ./applications/icom_app_template ./applications/my_dir", shell=True, executable="/bin/bash") >>> exit() mike@mike-VirtualBox:~/head$ tree ./applications/my_dir/ ./applications/my_dir/ ├── cdl │ ├── include │ ├── Makefile │ ... │ └── other ├── cds │ ├── include ... The only oddity that I do not have an answer for is that if I

Categories : Python

Which Google authentication method i need to use for command line script in python
I would just use foauth.org which makes OAuth 2.0 much simpler. You could also use the requests-foauth library which allows to interact with foauth.org as well. Another simple (I mean clean, concise, and pythonic) library to use is python-foauth2, which comes with a full example using google APIs. Some notes: OAuth2 Service account are meant for server to server applications, meaning it should not be tied to your account (or your calendar). For scripts, it's much better to follow the instructions for OAuth2 for installed apps; open up a browser to authorize the app / script and get a code that you can redeem for a token. The instructions for OAuth2 for devices is almost the same but provides 2 codes, one to enter in a browser and one to store on the device (or both from a computer...).

Categories : Python

Using ProcessBuilder to execute a python script with command line options
Just give them as separate strings in the array, instead of combining the last two into "val_31 val_32": String[] command = {"script.py", "run", "-arg1", "val1", "-arg2", "val2" , "-arg3" , "val_31", "val_32", }; Otherwise it will escape the space in between val_31 and val_32 because you are telling it that they're a single parameter. Incidentally, you can also use the varargs constructor and skip having to create an array, if you want: ProcessBuilder probuilder = new ProcessBuilder( "script.py", "run", "-arg1", "val1", "-arg2", "val2" , "-arg3" , "val_31", "val_32");

Categories : Java

How to pass dictionary as command line argument to python script?
Check this: >>> from sys import argv >>> from re import findall >>> args = ' '.join(argv[1:]) >>> pattern = r'([^=]+)s*=s*[s*([^]]+)s*]' >>> d = dict((t[0].strip(), map(lambda x: x.strip(', '),t[1].split())) for t in findall(pattern,args)) >>> for k,v in d.items(): try: d[k] = map(int,v) except: pass >>> d {'names': ['"J.J."', '"April"'], 'years': [25, 29]}

Categories : Python

Using windows command line to run python script with passing of url argument
I think the problem is the way you specify your url, it needs to have the http:// part at the start. It works for me when I type python sys.py http://www.google.com/ but fails with python sys.py www.google.com (Note that I am using linux with python 2.7 but I think it may be the same problem for you)

Categories : Windows

How to Run a Command Line python script in IDLE in windows Environment
It doesn't seem like IDLE provides a way to do this through the GUI, but you could do something like: mocking them in your if __name__ == '__main__': where you intercept the command line arguments. try: __file__ except: sys.argv = [sys.argv[0], 'argument1', 'argument2', 'argument2'] You can also try, idle.py -r scriptname.py arg1 arg2 arg3

Categories : Python

python script runs from command line but using subprocess gives error
When using subprocess.Popen() the first argument should be a list with a separate entry for each argument to the process you want to run: run=subprocess.Popen([sys.executable, 'maps2.py', '-i=/media/babak/LaCie/necessary/visualisation/CMIP3_Babak/Temperature/bccr_bcm2_0', '-o=temp/CMIP3', '-p=temp_001' ]) What you currently have would be the equivalent to running the following on the command line: python 'maps2.py -i=/media/babak/LaCie/necessary/visualisation/CMIP3_Babak/Temperature/bccr_bcm2_0 -o=temp/CMIP3 -p=temp_001'

Categories : Python

Always given command line before python fabric command is executed on remote
Interesting, I don't have such issue, your code works fine for me (up to adding env.key_filename and env.password) c:work>fab hello [x.x.x.x] Executing task 'hello' [x.x.x.x] run: touch hello.world Done. Disconnecting from x.x.x.x... done. I'm using Fabric 1.7.0 and Paramiko 1.11.0. Possibly it's a problem of the terminal on your server.

Categories : Python

Defining the command line arguments of a linux command in python
format is your friend: import os, sys if len(sys.argv) == 2: os.system("sudo rtcwake -m off -s {}".format(sys.argv[1])) else: print "usage: ..." so the seconds are command line parameters. Or, you can make it interactive: import os secs = raw_input() os.system("sudo rtcwake off -s {}".format(secs)) to verify that the user input is an integer: try: secs = int(secs) except: print 'usage: '

Categories : Python

Why does this work in the Python IDLE shell but not when I run it as a Python script from the command prompt?
As @Sukrit Kalra says, don't use datetime.py as your file name. Python is getting confused with which datetime is which (and is importing itself!). Maybe; $ mv datetime.py my_datetime.py

Categories : Python

How to execute command line ffmpeg commands programatically in android?
Recently I came across the similar problem. My solution is to simulate a command line in Java program. Firstly, I add a function to the file "ffmpeg.c": int cmd_simulation(int argc, const char** argv) { OptionsContext o = { 0 }; // int64_t ti; reset_options(&o, 0); av_log_set_flags(AV_LOG_SKIP_REPEATED); parse_loglevel(argc, argv, options); if(argc>1 && !strcmp(argv[1], "-d")){ run_as_daemon=1; av_log_set_callback(log_callback_null); argc--; argv++; } avcodec_register_all(); avfilter_register_all(); av_register_all(); avformat_network_init(); //show_banner(argc, argv, options); term_init(); parse_cpuflags(argc, argv, options); /* parse options */ parse_options(&o, argc, argv, options, opt_output_file); if (nb_output_files <= 0 && nb

Categories : Android

How to copy audio stream using FFMpeg API ( not a command line tool )
Your question is vague without some kind of code to go along with it, as trust me there are a lot of things that can go wrong when using ffmpeg's libraries directly (and on Windows there is no debuging). Unfortunately ffmpeg's libraries are not well documented so it is generally best to read the source code for ffmpeg in order to use its libraries. Find the equivalent command line options to perform what you want and track that through ffmpeg's source to see the library calls.

Categories : Opencv

android sound overlap command line ffmpeg not working
Check out those resources for Audio/Video tasks with FFmpeg for Android: Tutorial to compile FFmpeg for Android: http://www.roman10.net/how-to-build-ffmpeg-with-ndk-r9/ FFMpeg API examples: http://ffmpeg.org/doxygen/trunk/examples.html Also if you search github for FFmpeg and Android you'll find a lot of resources. Hope this helps, Cheers.

Categories : Android

How do I accept user input on command line for python script instead of prompt
Replace src = input('Enter Path to src: ') with: import sys src = sys.argv[1] Ref: http://docs.python.org/2/library/sys.html If your needs are more complex than you admit, you could use an argument-parsing library like optparse (deprecated since 2.7), argparse (new in 2.7 and 3.2) or getopt. Ref: Command Line Arguments In Python Here is an example of using argparse with required source and destination parameters: #! /usr/bin/python import argparse import shutil parser = argparse.ArgumentParser(description="Copy a file") parser.add_argument('src', metavar="SOURCE", help="Source filename") parser.add_argument('dst', metavar="DESTINATION", help="Destination filename") args = parser.parse_args() shutil.copyfile(args.src, args.dst) Run this program with -h to see the help message.

Categories : Python

Python: simple example trying to create a unix command-line executable - why won't it work?
Get rid of the spaces in #! /usr/local/bin/ python so it's #!/usr/local/bin/python. You may also want to make it #!/usr/bin/env python, which will select the first Python interpreter in your path, but that's not recommended for published modules. (Although, neither is /usr/local/bin/python).

Categories : Python

Python: Can't start Selenium Webdriver (Firefox) via a script, but it works via command line
Solved it by changing the permissions of the folder containing the Python script that called the webdriver from 755 to 757 (i.e., I gave write permissions to all users). I'm not sure whether this was a quirk of my situation because of something else I overlooked or whether there's actual insight to be gained here, but I'd say the take home lesson is if weird stuff is happening when working on an unfamiliar server, check the permissions.

Categories : PHP

Concatenate / Join MP4 files using ffmpeg and windows command line batch NOT LINUX
From reading your question, I'd suggest that the configuration file might look like this: # this is a comment file 'C:UsersJoe1Maysession3 eadyforfinalconversionTitlefile.mp4' file 'C:UsersJoe1Maysession3 eadyforfinalconversionEnglishfile.mp4' It may need double quotes around the pathfilenames instead of single quotes, for Windows. Try it both ways.

Categories : Windows

OpenCV using command line argument for input image (Python)
In python and most other languages argv[0] contains the program name. Try using argv[1] to get the correct result. Here is some Python Documentation to help you. Python has an amazing library of documentation I highly recommend using it.

Categories : Python

Piping output from 1 command to other command in an adb shell command line
One way is to create a shell script containing the commands you want and then run the shell script. Since the Android root filesystem is not writeable at run time (usually, unless you have rooted your device and remount it), you can copy the file to the removable (or emulated) storage, for example /sdcard. Then run the script using the command adb shell sh /sdcard/your-script-name. Because each script runs in its own subshell, both of your commands will be executed in the same shell on the device (you can confirm it with ps).

Categories : Android

Flyway command line filesystem migrations from actual command line input
flyway.cmd -configFile=/path/to/other/configFile.conf should do what you want. I just checked and it seems I forgot to document this on the website (It is in the usage description of the tool itself). Could you file an issue against the website, requesting this to be added?

Categories : Windows

how to read multiline output command line by line, in a shell script?
Maybe I found a different solution, where I can use variables also outside the loop I have to change the default IFS to newline echo Searching for android virtual devices ... IFS=$' '; for l in $(${PROGDIR}/android list avd) ; do VAR1=$(echo $l | cut -d: -f1 | sed -e 's/s*//'); #sed removes trailing blanks if [ $VAR1 == "Name" ]; then NUM_AVD=$(($NUM_AVD+1)); fi; done echo "NUM_AVD=$NUM_AVD" In this case NUM_AVD is correctly 2

Categories : Shell

The DB2 SQL script is hanging in shell script, but working successfully in command line
Are you sure DB2 is blocking? Did you put a semicolon between commands db2 CONNECT TO ktest4 ; db2 -v -f /tmp/sql/application_system/opmdb2_privilege_remove.sql.5342 In order to trace the execution, I advise you to put some output, in order to detect where is it blocking date ; db2 -r /tmp/output.log CONNECT TO ktest4 ; db2 -r /tmp/output.log values current timestamp ; db2 -r /tmp/output.log -v -f /tmp/sql/application_system ; db2 -r /tmp/output.log values current timestamp ; db2 -r /tmp/output.log terminate With a command like this, you will save all outputs, and then you could check where is the error.

Categories : SQL

bash shell script error works on command line, not in script
Variables are supposed to contain data, and bash treats them as data. This means that shell meta-characters like quotes are also treated as data. See this article for a complete discussion on the topic. The short answer is to use arrays instead: ASCIIDOC_OPTS=( --asciidoc-opts='-a lang=en -v -b docbook -d book' ) DBLATEX_OPTS=( --dblatex-opts='-V -T db2latex' ) cmd=(a2x -v -f pdf -L "${ASCIIDOC_OPTS[@]}" "${DBLATEX_OPTS[@]}" "$1".asciidoc) # Print command in pastable format: printf '%q ' "${cmd[@]}" printf ' ' # Execute it "${cmd[@]}" Make sure not to use eval: eval "$cmd" #noooo This will appear to work with your code as you posted it, but has caveats and security problems.

Categories : Bash

Run R script from command line
You need the ?Rscript command to run an R script from the terminal. Check out http://stat.ethz.ch/R-manual/R-devel/library/utils/html/Rscript.html Example ## example #! script for a Unix-alike #! /path/to/Rscript --vanilla --default-packages=utils args <- commandArgs(TRUE) res <- try(install.packages(args)) if(inherits(res, "try-error")) q(status=1) else q()

Categories : R

R script from command line
Rscript is very handy (R CMD BATCH is the old way to ) specially under windows, But generally under I create a batch file to avoid all path's headache. For example say launcher.bat: @echo off C: PATH C:ProgrammeRR-3.0.1in;%path% cd PATH_TO_YOUR_RSCRIPT Rscript tryCatch.R 1 pause And open a console(using cmd) , go where you have stored your launcher.bat and launch it. Or from the R cosnole using shell: shell('path_to_launcherlauncher.bat')

Categories : R

Run PHP script from command line and max_execution_time
Yes. See http://php.net/cli and there specifically http://php.net/commandline.differences

Categories : PHP

Command Line PHP Script not executing correctly
use this mysql_query() instead of mysql_subquery() you should use PDO or mysqli instead of mysql. mysql is already deprecated

Categories : PHP

Running Perl Script from Command Line?
According to the documentation: Perl Express is not tied to a specific Perl port and should work with any build for Windows. and the system requirements: Windows 98/Me/2000/XP/2003, Perl Interpreter So you, presumably, have a separate Perl distribution already installed somewhere. That should have a perl.exe executable that you can use to run your script.

Categories : Perl

How do I get a Blender exporter script to run from the command line?
I finally figured this out and thought it would be a good idea to come back and share the answer. First here is the file that works. # Required Blender information. bl_info = { "name": "My Exporter", "author": "", "version": (1, 0), "blender": (2, 65, 0), "location": "File > Export > Test (.tst)", "description": "", "warning": "", "wiki_url": "", "tracker_url": "", "category": "Import-Export" } # Import the Blender required namespaces. import sys, getopt import bpy from bpy_extras.io_utils import ExportHelper # The main exporter class. class MyExporter(bpy.types.Operator, ExportHelper): bl_idname = "export_scene.my_exporter"; bl_label = "My

Categories : Python

Shell script array from command line
This tcl script uses regex parsing to extract pieces of the commandline, transforming your third argument into a list. Splitting is done on whitespaces - depending on where you want to use this may or may not be sufficient. #!/usr/bin/env tclsh # # Sample arguments: 1 2 {element1 element2} 4 # Split the commandline arguments: # - tcl will represent the curly brackets as { which makes the regex a bit ugly as we have to escape this # - we use '->' to catch the full regex match as we are not interested in the value and it looks good # - we are splitting on white spaces here # - the content between the curly braces is extracted regexp {(.*?)s(.*?)s\{(.*?)\}s(.*?)$} $::argv -> first second third fourth puts "Argument extraction:" puts "argv: $::argv" puts "arg1: $first" puts "arg2: $s

Categories : Arrays

Stop bash script without command line
I think it is a little bit overcomplicated. Actually you do not need to start bash as it is started when You start ./executeServer.sh. Add executable rights to ./executeServer.sh and start it as it is. And do not need to start it in the background, as it already starts Server in the background in the script.

Categories : Bash

How to work with MSDeploy through command line?
It sounds like you are trying to execute the bat file on one machine from another machine? If so have you considered PsExec from Sysinternals? http://technet.microsoft.com/en-us/sysinternals/bb897553

Categories : Iis

How to issue a command from the command line of a process running on Linux
If you don't mind waiting for the calls to finish (one at a time) before returning control to your program, you can use the subprocess library. If you want to start something running and not wait for it to finish, you can use the multiprocessing library.

Categories : Python

different order of command line options in a command affecting my output
getoptlong() is doing exactly what it is supposed to do. The format-string "d:g:hv" implies that the parameters d and g require a value. Anything specified following a command-line parameter is consider a value being passed to it. You should run your program as $program --download file --version Checkout this detailed example demonstrating the various aspects of using getoptlong(). How rm can handle the differing position of its cmd-line params? Apparently because rm's parameters (r, v etc.) do NOT accept any values as arguments. Thus directory does not get passed to any of them but rather is a separate cmd-line argument on its own. You can confirm this from the source-code of rm. To do something similar for your program, you will need to modify the optstring to "dghv" a

Categories : C

How do I set a command-line flag when running a Symfony2 Command test?
disabling debug in the kernel You can initialize the kernel in your test's setUp() method with debug set to false. use SymfonyBundleFrameworkBundleTestWebTestCase; class YourCommandTest extends WebTestCase { public function setUp() { static::$kernel = static::createKernel(array('debug' => false)); static::$kernel->boot(); // ... } Have a look at WebTestCase->createKernel(). using enviroments If you don't want the debug output in your logs edit/create app/config/config_test.yml and edit ... monolog: handlers: file: type: stream level: debug # log-level ... ... to another log level that suits your needs. Then execute your command using the test environment with --env=test

Categories : PHP

PHP exec command works in shell and php command line but not on website
You can add the second parameter to help debug, $output will display what the cp command is doing, whether it be an error or not. I would also recommend placing quotes around the files, just in case something with a space gets in there. $src = "/mnt/..."; $dest = "/var/www/..."; exec("cp '$src' '$dest'", $output, $retrun_var); var_dump($output, $retrun_var);

Categories : PHP



© Copyright 2017 w3hello.com Publishing Limited. All rights reserved.