I'm having trouble running gdal2tiles.py through a command line. I followed instructions on installing gdal from http://cartometric.com/blog/2011/10/17/install-gdal-on-windows/ I then verified through command prompt that gdal was installed by typing in gdalinfo --version, and the correct version came up which means that my path and variables are set.
So when I try to run this:
gdal2tiles.py -p raster -z 0-6 test.jpg abc
I keep getting an error that says "error: No input file was specified" and
"Usage: gdal2tiles.py [options] input_file(s) [output]"
I am able to run other gdal commands and they work just fine. I've also tried to run
gdal2tiles.py test.jpg
and this gives the same error.
I'm pretty sure I have the right formatting so if anyone has any suggestions or might have a solution to this please let me know. Thanks
In command prompt just type in:
python gdal2tiles.py -p raster -z 0-6 test.jpg abc
That corrected the problem for me.
Related
I develop my c++ software on my MAC with xcode.
I have a program and I want to call curl and format the data with jq.
When I run/debug the program, the function
system("jq");
returns sh: command not found.
system("curl");
works fine.
When I run jq on the command line on my mac, it works fine.
I found the solution. The $PATH for XCODE is not the same as $PATH for the system. I had to add a extra PATH to my scheme in XCODE to sovlve that problem.
I have a problem and hope someone can help me. I am currently trying to write a script for Termux or Termux:Task. My script currently looks like this:
#!/data/data/com.termux/files/usr/bin/bash
cd /./sdcard/www/public/
wp post list sleep 5
Every time I load the script I get the following error message:
/data/data/com.termux/files/usr/bin/wp: /usr/bin/env: bad interpreter: No such file or directory.
I've been looking for a solution to my problem for hours, unfortunately without success.
I am using an extension for Termux called "WordPress CLI". When I start termux and enter the commands individually, everything works. But as soon as I write the commands into a sh script and start it doesn't work anymore. :(
Can anyone help me?
Thanks a lot
This is simple error you can fix it by replacing !/data/data/com.termux/files/usr/bin/bash. With #!/data/data/com.termux/files/usr/bin/bash
Please tell if you get error again
Try with #!/usr/bin/env bash in the shebang line.
Termux-exec allows you to execute scripts with shebangs for traditional Unix file structures. So shebangs like #!/bin/sh and #!/usr/bin/env python should be able to run without termux-fix-shebang.
From https://wiki.termux.com/wiki/Termux-exec
According to doc:
Why do I keep getting a '/bin/sh bad interpreter' error?
This error is thrown due to access script interpreter at nonexistent
location.
Termux does not have common directories like /bin, /sbin, /usr/bin at
their standard place. There is an exception for certain devices where
/bin is a symbolic link to /system/bin, but that does not make a
difference.
Interpreters should be accessed at this directory only:
/data/data/com.termux/files/usr/bin
There are three ways to fix this:
Install termux-exec by using pkg install termux-exec. It won’t affect the current session, but after a restart should work without
any setup. Not needed if your Termux is up to date. If still not
working, try the next workaround.
Use command termux-fix-shebang to fix the shebang line of specified file.
Use termux-chroot from package proot to setup a chroot environment mimicking a normal Linux file system in Termux.
termux-fix-shebang my_script.py of second method work for me, which it modify the shebang(first line of my_script.py) from #!/usr/bin/env python to #!/data/data/com.termux/files/usr/bin/env python. Since /usr/bin/ is not exist in Android, that's why it throws the error /usr/bin/env: bad interpreter: No such file or directory. The other solution is run with python my_script.py, neither of my_script.py nor ./my_script.py.
In my test, termux-exec of the first method only work if I added correct shebang in main script(child OR child of child script no need) and ran command export LD_PRELOAD=/data/data/com.termux/files/usr/lib/libtermux-exec.so.
And for the issue of this question, error shows /usr/bin/env in the middle with /data/data/com.termux/files/usr/bin/wp even though the shebang of script #!/data/data/com.termux/files/usr/bin/bash looks ok, it means that wp command (located at /data/data/com.termux/files/usr/bin/wp) used inside the script contains shebang #!/usr/bin/env wp and should modify it to #!/data/data/com.termux/files/usr/bin/env wp too. termux-exec of first method should fix this specific case too(already has correct shebang in main script).
I'm using python 3.5 and downloaded an updated version of my project from bitbucket.
When I try to makemigrations I get:
django.core.exceptions.FieldDoesNotExist: users.user has no field named 'surname'
Is there a way to find where this is executed? Because in my models.py I have users.lastname.
Thank you in advance!
You can grep for the .surname field
In Linux just open a terminal at your root dir of the project, and type grep -irn .surname
The i is "Case Insensitive"
The r is "Recursive"
and the n is "Line Number"
This will tell you the file and where in the file the issue is.
if you don't have linux, and you don't bave bash for windows on your machine, then it's well worth downloading cygwin, and you can issue the same command as above to search for the call to .surname
I installed Go with homebrew and it usually works. Following the tutorial here on creating serverless api in Go. When I try to run the unit tests, I get the following error:
# _/Users/pro/Documents/Code/Go/ServerLess
main_test.go:6:2: cannot find package "github.com/strechr/testify/assert" in any of:
/usr/local/Cellar/go/1.9.2/libexec/src/github.com/strechr/testify/assert (from $GOROOT)
/Users/pro/go/src/github.com/strechr/testify/assert (from $GOPATH)
FAIL _/Users/pro/Documents/Code/Go/ServerLess [setup failed]
Pros-MBP:ServerLess Santi$ echo $GOROOT
I have installed the test library with : go get github.com/stretchr/testify
I would appreciate it if anyone could point me in the right direction.
Also confusing is when I run echo $GOPATH it doesnt return anything. same goes for echo $GOROOT
Some things to try/verify:
As JimB notes, starting with Go 1.8 the GOPATH env var is now optional and has default values: https://rakyll.org/default-gopath/
While you don't need to set it, the directory does need to have the Go workspace structure: https://golang.org/doc/code.html#Workspaces
Once that is created, create your source file in something like: $GOPATH/src/github.com/DataKid/sample/main.go
cd into that directory, and re-run the go get commands:
go get -u -v github.com/stretchr/testify
go get -u -v github.com/aws/aws-lambda-go/lambda
Then try running the test command again: go test -v
The -v option is for verbose output, the -u option ensures you download the latest package versions (https://golang.org/cmd/go/#hdr-Download_and_install_packages_and_dependencies).
I am trying to start mjpg-streamer from a python script on the raspberry pi. The instructions for how to start it from the command line are here and consist of running
export LD_LIBRARY_PATH=. ./mjpg_streamer -o "output_http.so -w ./www"
-i "input_raspicam.so"
from /var/www/mjpg-streamer/mjpg-streamer-experimental. When I do it in the terminal, it works fine.
However, I am trying to run it using subprocess.call like this:
subprocess.call('export LD_LIBRARY_PATH=.', shell=True, cwd='/var/www/mjpg-streamer/mjpg-streamer-experimental')
subprocess.call('./mjpg_streamer -o "output_http.so -w ./www" -i "input_raspicam.so -x 640 -y 480 -fps 15 -vf -hf"', shell=True, cwd='/var/www/mjpg-streamer/mjpg-streamer-experimental')
And that is giving me the error:
MJPG Streamer Version: svn rev: ERROR: could not find input plugin
Perhaps you want to adjust the search path with:
# export LD_LIBRARY_PATH=/path/to/plugin/folder
dlopen: input_raspicam.so: cannot open shared object file: No such file or directory
I'm guessing it is because the first command doesn't provide the relevant link to the plugin? I'm not entirely sure of how these commands work anyway, so any insight into that would also be helpful!
I have also tried using os.system to run these commands and have received the same error.
I'm sure I'm doing something silly, so thanks in advance for your patience!