I am writing an eclipse plugin that will take input of a file name, pass that to a UNIX command and get the output back (The command is to get file path of entered file name from CVS repository). My basic plugin code is under development, but I am not finding any info on how can I execute UNIX commands from eclipse. Any pointers would be helpful.
Runtime.exec(...) from the Java standard library should do what you need to execute UNIX shell commands that are in your path of the user that is executing eclipse. If you want to call UNIX C libraries API you can use the JNA library.
Related
I'm writing scripts to automate some task to be executed from windows machine to remote ubuntu server, which uses putty-tools like plink.exe, pscp.exe and psftp.exe.
My python program is able to run successfully but I'm trying to build a single independent standalone file which can be run in another PC even if that PC do not have these putty tools available.
I'm using below commands
python -m nuitka --enable-plugin=tk-inter --windows-disable-console --onefile --standalone my_program.py
I'also found related question here but it was not answered
Bundle third party .exe in Python code and produce another portable .exe
Can someone please help me on this.
Fortunately I found answer for my question by reading the nuitka user manual, we need to use one of the below format based on the requirement. In my case I used second one.
# This will find a file near your onefile.exe
open(os.path.join(os.path.dirname(sys.argv[0]), "user-provided-file.txt"))
# This will find a file inside your onefile.exe
open(os.path.join(os.path.dirname(__file__), "user-provided-file.txt"))
And while packing my command become something like below,here it will include all the files available in source directory to target directory in "onefile.exe"
python -m nuitka --enable-plugin=tk-inter --windows-disable-console --onefile
--include-data-dir=<source>=<target> --standalone my_program.py
How am i able to execute UNIX commands on my PC Command prompt? Note i do not have cygwin installed, although i was going to before i discovered this.
This is a development machine so i have a lot installed on it like ruby, python, git, github, node and so on.
What does this mean? can i use this without cygwin?
Here is a list of programs installed on my PC program list
How am I able to execute UNIX commands on my PC Command prompt?
You can use the where command in a cmd shell to find out the exact location of your Unix commands, for example:
where ls
This assumes, of course, that ls is located somewhere in your current PATH.
The location returned will show you in which directory your Unix commands are installed and may be enough for you to determine how they were installed.
The where command is roughly equivalent to the Unix which command.
By default, the search is done in the current directory and in the
PATH.
Syntax
WHERE [/r Dir] [/q] [/f] [/t] Pattern ...
WHERE [/q] [/f] [/t] [$ENV:Pattern
Source where
Further Reading
An A-Z Index of the Windows CMD command line - An excellent reference for all things Windows cmd line related.
where - Locate and display files in a directory tree.
Running Unix commands in windows can be done by having a tool like Cygwin which has those commands.
You can also get many of those commands compiled for windows and then run them using the command with the full path or only the command if the executable is in a path known by adding the paths to the executable files in Windows by :
1) Running in the terminal: PATH %PATH%;C:\<new_path>
2) Creating command aliases like: doskey np=C:\<new_path>\new_command.exe $*. $* is used to be able to transmit parameters
I'm trying to understand how to package a command line application written in Clojure for distribution. I don't want users to have to use java -jar myproject.jar arg1 arg2 to run the program. PHP has something called "Phar" files, which are basically executable zip files, so they include a shebang that tells POSIX systems how to unpack and run them.
I've seen other Clojure apps that allow the jar file to be set chmod +x and then executed directly. How do they achieve this? Uberjar just seems to make a jar that requires the java -jar prefix.
You can do this using lein-bin.
Ah, I just found the answer to my own question. It's not standard functionality and you basically have to roll your own: https://github.com/tailrecursion/boot/blob/master/Makefile#L21
I had builded .amj script from Teradata OLELoad GUI which connects to access and load data
to Teradata ?
I was able to successfully run the script using OLELoad GUI Utility.
Is there a way to run .amj file from command prompt ?
Thanks.
When you launch the script with OLELoad you have to use a TTU as Fastload, Bteq or whatever. You can do the same from the command line. You just have to call the TTU you choose (for example Fastload) with your script in the parameter section.
Example:
Bteq.exe < Your_script.txt
You mention that you are using an amj file. That file must be referred into your script.
You should be able to reference the .AMJ file as part of an INMOD on some of the Teradata Utilities. Refer to the Teradata Tools and Utilities Manual for the Teradata OLE DB Access Module here for examples.
I am writing robot tests for web testing using Google's Robot Framework with SeleniumLibrary (a test library) , one of my test involves uploading a file from the desktop by clicking on a"Browse" button on the webpage and using the windows file explorer window that pops up to navigate to and select the file ( providing a text path to file is disabled on the website for security reasons.) I have tried digging around but found little on automating this Windows File Explorer action , is there a way I can do this ?
After downloading the AutoIt library and trying to install it is asking for wincom32./python window extensions.And i am trying to install it is giving some error like
Building pywin32 2.7.217.0
Trace-back (most recent call last):
File "setup.py", line1944, in <module>
""" % dirs).split(),
File "setup.py", line 603, in __init__
if os.path.isfile(os.path.join(sdk_dir, "include", "activdbg.h")):
File"C:\Python27\lib\ntpath.py", line 96 in join
assert len(path) > 0
TypeError: object of type 'NoneType' has no len()
Below is a quick step to step guide to install autoit for robotframework in Windows (as what versions work with what in python is a pain):
First you will need a 32 bit python as autoit will not install for windows 64bit. I have used:
Python 2.6
Then from http://sourceforge.net/projects/pywin32/files/pywin32/Build%20217/
Download the windows installer so for python 2.6 it will be:
pywin32-217.win32-py2.6.exe
Now on the command prompt go to the location of where you downloaded the autoit files ex:
- cd C:\Development\Downloaded files\AutoItLibrary-1.1
and then type
- python setup.py install
If successful you will see lines in the cmd line such as:
Generating...
Importing module
running install
running build
running build_py
creating build
creating build\lib
creating build\lib\AutoItLibrary
copying src\AutoItLibrary\Counter.py -> build\lib\AutoItLibrary
copying src\AutoItLibrary\Logger.py -> build\lib\AutoItLibrary
copying src\AutoItLibrary\__init__.py -> build\lib\AutoItLibrary
running install_lib
copying build\lib\AutoItLibrary\Counter.py -> C:\Python26\Lib\site- packages\AutoItLibrary
copying build\lib\AutoItLibrary\Logger.py -> C:\Python26\Lib\site-
Now run the test
C:\RobotFramework\Extensions\AutoItLibrary\tests
Note: Ensure you have the environment variables set correctly:i.e.
- c:\python26 for python
- c:\python26\scripts for pybot
You can now run your robotframework tests by creating an exe and calling
- Run C:\RobotFramework\Seans Autoit Files\FF_FileUpload.exe
To find how to create the autoit exe visit the autoit website.
Are you attempting to install the pywin32 extensions from source? There are windows installers for all flavours of windows so I would recommend you install using an installer.
(one other thing, google did not make robot framework. It was Nokia Siemens networks...)
Use the Keyword 'Choose File'. No need for AutoIT Lib
Name: Choose File
Source: Selenium2Library
Arguments: [ locator | file_path ]
Inputs the file_path into file input field found by identifier.
This keyword is most often used to input files into upload forms. The file specified with file_path must be available on the same host where the Selenium Server is running.
Example: Choose File my_upload_field C:\Automation\sample.csv
"Choose File" worked in my case. Please note that in my case this made robot write the file path into the input field which was otherwise not editable manually.