Can't open .py fileon cmd when working directory folder and path is set - command-line

Following is the output from the CMD. Receiving [Errno 2]. Notice a.py is in the folder with python.exe and i am able to launch python through py command.
C:\Users\x\AppData\Local\Programs\Python\Python36>a.py
C:\Users\x\AppData\Local\Programs\Python\Python36\python.exe: can't open file '#': [Errno 2] No such file or directory
C:\Users\x\AppData\Local\Programs\Python\Python36>dir
Volume in drive C has no label.
Volume Serial Number is x
Directory of C:\Users\x\AppData\Local\Programs\Python\Python36
04/02/2018 06:46 PM <DIR> .
04/02/2018 06:46 PM <DIR> ..
04/01/2018 07:30 PM 600 a.py
12/23/2016 08:09 AM 100,504 python.exe
12/23/2016 08:06 AM 52,888 python3.dll
12/23/2016 08:06 AM 3,555,992 python36.dll
12/23/2016 08:09 AM 98,968 pythonw.exe
12/23/2016 07:10 AM 8,434 README.txt
C:\Users\x\AppData\Local\Programs\Python\Python36>py
Python 3.6.0 (v3.6.0:41df79263a11, Dec 23 2016, 08:06:12) [MSC v.1900 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>>

You have to run like this
python.exe a.py
or if path is set correctly,
python a.py

Related

Converting .osm.pbf to .osm

I am trying to convert a .osm.pbf file to a .osm file.
https://wiki.openstreetmap.org/wiki/Osmosis/Quick_Install_(Windows)
I followed the instructions here:
Installed Java Runtime
Downloaded osmosis and extracted it to a directory
Created a bat file containing "C:\Users\paul\Desktop\osmosis\bin\osmosis.bat"
In a dos command prompt when im in the directory of where the batch file I created is located I try:
osmosis --read-pbf c:\dir\somefile.osm.pbf --write-xml c:\dir\somefile.osm
It just runs really quickly and doesnt convert the file and gives this output:
Nov 24, 2021 4:40:20 PM org.openstreetmap.osmosis.core.Osmosis run
INFO: Osmosis Version 0.48.3
Nov 24, 2021 4:40:22 PM org.openstreetmap.osmosis.core.Osmosis run
INFO: Preparing pipeline.
Nov 24, 2021 4:40:22 PM org.openstreetmap.osmosis.core.Osmosis run
INFO: Launching pipeline execution.
Nov 24, 2021 4:40:22 PM org.openstreetmap.osmosis.core.Osmosis run
INFO: Pipeline executing, waiting for completion.
Nov 24, 2021 4:40:22 PM org.openstreetmap.osmosis.core.Osmosis run
INFO: Pipeline complete.
Nov 24, 2021 4:40:22 PM org.openstreetmap.osmosis.core.Osmosis run
INFO: Total execution time: 2297 milliseconds.
Some sources provide a .osm.bz2 or .osm.zip format which uses standard compression. You can use a program like 7zip to covert those files to a raw .osm file. This format is the easiest to convert to a raw .osm.
However if you need to convert a binary .pbf to a raw .osm I would recommend the tool OSM Convert. Download the large file support version. Unfortunately Osmosis has been unmaintained since September 2018, so try to use newer tools. There is a list of them kept here on the OpenStreetMap Wiki.
With OSM Convert I've used this command with success on Windows 10: osmconvert us-latest.osm.pbf --out-osm -o=us-latest.osm_01.osm to convert us-latest.osm.pbf to us-latest.osm_01.osm

How to open a file in D drive through command prompt

Path of the folder: D:\Brian\adrk_v1_0 ; this folder has a file called 'filename' I wish to open the file, 'filename' using the command prompt.
I tried doing it, by writing the following
C:\Users\Anshuman
C:\Users\Anshuman> cd /d D:Brian\adrk_v1_0
D:\Brian\adrk_v1_0>
But when I try to open the 'makefile' this happens:
Directory of D:\Brian\adrk_v1_0
03-10-2021 11:13 <DIR> .
03-10-2021 11:13 <DIR> ..
13-12-2002 22:16 <DIR> Const
13-12-2002 22:16 <DIR> Energy
13-12-2002 22:16 <DIR> Form
13-12-2002 22:16 <DIR> GMICPP
13-12-2002 22:16 <DIR> Group
13-12-2002 22:16 <DIR> Input
14-12-2002 04:13 1,046 i_data.txt
11-12-2002 03:50 3,294 makefile
13-12-2002 22:16 <DIR> Master
13-12-2002 22:16 <DIR> Output
14-12-2002 04:20 223 o_rmv.dat
14-12-2002 04:20 3,718 o_sdf.dat
14-12-2002 04:20 223 o_sum.dat
14-12-2002 04:20 151 o_vac.dat
13-12-2002 22:16 <DIR> PD
14-12-2002 06:16 2,394 readme.txt
13-12-2002 22:16 <DIR> SDF
13-12-2002 22:16 <DIR> Vector
7 File(s) 11,049 bytes
13 Dir(s) 579,931,025,408 bytes free
D:\Brian\adrk_v1_0>makefile
'makefile' is not recognized as an internal or external command,
operable program or batch file.
I have tried changing the path to C: System 32 in the environment variable.
Looks like you should specify a texteditor, for Example:
notepad makefile

Mozilla JetPack Invalid Filename

I'm trying to create simple Mozilla add-on which is using external JS file;
Folders & Files
/var/www/html/add-ons/hello
/var/www/html/add-ons/hello/index.js
/var/www/html/add-ons/hello/package.json
/var/www/html/add-ons/hello/script/data/test.js
/var/www/html/add-ons/hello/index.js
// Import the page-mod API
var pageMod = require("sdk/page-mod");
// Create a page-mod
pageMod.PageMod({
include : "*",
contentScriptFile : "./test.js",
contentScript: 'window.alert("loaded");'
});
/var/www/html/add-ons/hello/package.json
{
"title": "My Jetpack Addon",
"name": "test",
"version": "0.0.1",
"description": "A basic add-on",
"main": "index.js",
"author": "",
"engines": {
"firefox": ">=38.0a1",
"fennec": ">=38.0a1"
},
"license": "MIT",
"keywords": [
"jetpack"
]
}
/var/www/html/add-ons/hello/script/data/test.js
alert("Hello World");
Commands I Run to Test
cd /var/www/html/add-ons/hello
jpm init (actually package.json file was created by this command)
jpm run -b /usr/bin/firefox (I use Ubuntu so I run it this way)
I test it live and I get loaded alert however I get following error;
console.error: script:
Error opening input stream (invalid filename?): resource://script/data/test.js
The folders and file are already exist within the root folder.
If this is the root;
/var/www/html/add-ons/hello shouldn't resource://script/data/test.js be referring to /var/www/html/add-ons/hello/script/data/test.js?
Where am I doing wrong?
Create your folder structure as below:
root folder: /var/www/html/add-ons/hello
place index.js, package.json within root folder.
move all the data that is packaged within your add-on to: /var/www/html/add-ons/hello/data
go to root folder - /var/www/html/add-ons/hello
run jpm run -b
this will create an xpi package, launch firefox.exe with temporary profile, install add-on.
ex: this is from win 7 x64 test project:
root directory: E:\Training\using_Angular
Directory of E:\Training\using_Angular
11/01/2015 08:26 AM <DIR> .
11/01/2015 08:26 AM <DIR> ..
09/29/2015 05:04 PM <DIR> data
09/29/2015 05:02 PM 548 index.js
08/12/2015 08:26 PM 221 package.json
Directory of E:\Training\using_Angular\data
09/29/2015 05:04 PM <DIR> .
09/29/2015 05:04 PM <DIR> ..
09/29/2015 05:04 PM <DIR> images
08/12/2015 08:26 PM 446 lang.json
09/29/2015 05:04 PM <DIR> lib
09/29/2015 05:04 PM <DIR> scripts
09/29/2015 05:04 PM <DIR> styles
09/29/2015 05:04 PM <DIR> html
Directory of E:\Training\using_Angular\data\html
08/12/2015 08:26 PM 446 pagescript.html
During run, the 'resource://' folder refers to contents packaged in your add-on.
for ex: resource://caaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa/data/html/pagescript.html

Schrödinger's file

I am puzzled by the following sequence of commands.
sh-4.2$ pwd
/home/willard
sh-4.2$ ls -l f
-rwxr-xr-x 1 willard users 59116 Jan 23 14:54 f
sh-4.2$ file f
f: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.15, BuildID[sha1]=0xea0e08ff2b5a062698d45b78177acdd6bf140d1f, stripped
sh-4.2$ ./f
sh: ./f: No such file or directory
sh-4.2$ strace ./f
execve("./f", ["./f"], [/* 32 vars */]) = -1 ENOENT (No such file or directory)
write(2, "strace: exec: No such file or di"..., 40strace: exec: No such file or directory
) = 40
exit_group(1) = ?
+++ exited with 1 +++
sh-4.2$ ls -l f
-rwxr-xr-x 1 willard users 59116 Jan 23 14:54 f
sh-4.2$ uname -a
Linux xdat10 3.6.2-1-ARCH #1 SMP PREEMPT Fri Oct 12 23:58:58 CEST 2012 x86_64 GNU/Linux
How is this possible?
I found someone having the same problem (with relative explanation)
Running 32bit binary on a 64bit system
Quoting the most important sentences:
This situation often arises when you try to run a binary for the right
system (or family of systems) and superarchitecture but the wrong
subarchitecture. Here you have ELF binaries on a system that expects
ELF binaries, so the kernel loads them just fine. They are i386
binaries running on an x86_64 processor, so the instructions make
sense and get the program to the point where it can look for its
loader. But the program is a 32-bit program (as the file output
indicates), looking for the 32-bit loader /lib/ld-linux.so.2, and
you've presumably only installed the 64-bit loader
/lib64/ld-linux-x86-64.so.2 in the chroot.
You need to install the 32-bit runtime system in the chroot: the
loader, and all the libraries the programs need. On Debian amd64, the
32-bit loader is in the libc6-i386 package. You can install a bigger
set of 32-bit libraries by installing ia32-libs.
I bet there's a better way to verify this but i'd try to exec
ldd ./f
and search in the output which loader is needed to exec'it
man 2 execve:
ENOENT The file filename or a script or ELF interpreter does not
exist, or a shared library needed for file or interpreter can‐
not be found.
You could run ldd against this binary to look for libraries that could not be mapped and install them from multilib.

Regarding Perl DBD::Oracle installation in local directory

I want to connect with the oracle database from a perl script in solaris servier. Able to see DBI is installed but not DBD::Oracle in the current perl version 5.8.4. I dont have root acess and working on my home user id. Download the DBD-Oracle-1.50 and unzipped in the local directory where my perl script exists. I want to copy the DBD Oracle library files into a custom directory and run the script since i dont have root acess. When i read the install script in the DBD-Oracle-1.50 it's says for manuall install i need to run the below scripts . Since i dont have root access i want to copy the library modules into the local directory. Not sure how to tell these scripts to install it in the local directory where my perl script exists.
Does installing DBI and DBD in a custom directory under my user id makes it work properly. Do those modules require root access to work properly? To use DBD::Oracle does oracle needs to be installed in server. My Understanding Oracle driver DBD::Oracle should take care of it.
perl Makefile.PL
make && make test
make install
> ls -tlr /usr/perl5/vendor_perl/5.8.4/sun4-solaris-64int total 956
> -rwxr-xr-x 1 root bin 15161 Mar 26 2005 Roadmap.pod
> -rwxr-xr-x 1 root bin 1048 Sep 5 2006 TASKS.pod
> -rwxr-xr-x 1 root bin 289343 Jun 26 2007 DBI.pm
> -rwxr-xr-x 1 root bin 4608 Jun 12 2008 goferperf.pl
> -rwxr-xr-x 1 root bin 1356 Jun 12 2008 dbixs_rev.pl
> -rwxr-xr-x 1 root bin 58386 Apr 3 2010 SNMP.pm drwxr-xr-x 3 root bin 7 Oct 13 2010 NetSNMP
> drwxr-xr-x 2 root bin 3 Oct 13 2010 Win32 drwxr-xr-x
> 8 root bin 19 Oct 13 2010 DBI drwxr-xr-x 2 root
> bin 4 Oct 13 2010 Bundle drwxr-xr-x 6 root other
> 6 Oct 13 2010 auto drwxr-xr-x 3 root bin 11 Oct 13
> 2010 DBD
>
> ls -ltr /usr/perl5/vendor_perl/5.8.4/sun4-solaris-64int/DBD total 543
> -rwxr-xr-x 1 root bin 111586 May 6 2006 Pg.pm
> -rwxr-xr-x 1 root bin 28785 Sep 27 2006 Proxy.pm
> -rwxr-xr-x 1 root bin 7937 Jan 25 2007 Sponge.pm
> -rwxr-xr-x 1 root bin 42836 Feb 6 2007 DBM.pm
> -rwxr-xr-x 1 root bin 19882 Mar 28 2007 File.pm
> -rwxr-xr-x 1 root bin 12051 May 10 2007 ExampleP.pm
> -rwxr-xr-x 1 root bin 43586 May 14 2007 Gofer.pm
> -rwxr-xr-x 1 root bin 3761 Jun 15 2007 NullP.pm drwxr-xr-x 4 root bin 4 Oct 13 2010 Gofer
If DBI is already installed, you should only need to install DBD::Oracle, though you might want to install a later version of DBI. You can install DBD::Oracle under your home directory, then set the PERL5LIB environment variable to that directory (or to include that directory). The long way to install is:
perl Makefile.PL PREFIX=~/perl #Or whatever sub-directory you like
make
make test
make install
Then include at least "~/perl/lib;~/perl/lib/site_perl" in PERL5LIB before running your programs (or include a 'use lib" in your programs).
You can also set certain environment variables like PERL_MM_OPT and PERL_MB_OPT so that you don't have to specify the PREFIX= on the command line (see docs for ExtUtils::MakeMaker and Module::Build). I also recommend cpanm and setting PERL_CPANM_HOME to something under your home directory.
Perl modules can be very well installed in a custom directory. This situation usually arises when you don't have root access to install the PM. Once you have installed DBI and DBD in your custom folder there are several different ways to make sure that perl is aware of this installation.
1. Set the environment variable PERL5LIB
Perl will look for modules in the directories specified in PERL5LIB environment variable before looking in the standard library and current directory, so you can set this variable to locate your modules.
The syntax is the same you use for the PATH environment variables, so you separate the directories with colons on unix and with a semicolon on Windows.
Example:
# unix, bourne shell
PERL5LIB=/home/path/lib:/usr/another/path/lib; export PERL5LIB
Be aware that scripts running with -T option (taint checks) do not use that variable, so in those cases this option won't work.
2. Use '-I' command line parameter
The syntax should be something like:
perl -I /home/path/lib -I /usr/another/lib script.pl
3. Add the library path in your script
The command for including the path in your script is: use lib "path".
Notice that this statement prepends "path" to the #INC array, so it's basically the same as unshift #INC, "path"
Example:
#!/usr/bin/perl
use lib "/home/path/lib";
use lib "/usr/another/lib";