TabViewer / gtabview

Simple graphical tabular data viewer
MIT License
33 stars 3 forks source link

Run gtabview as script under Windows #20

Closed s-celles closed 3 years ago

s-celles commented 9 years ago

Hello,

I'm using Anaconda Python 3 under Windows 7.

To run gtabview as script I need to do:

cd C:\Anaconda3\Scripts
python gtabview filename_or_table_uri

or

python C:\Anaconda3\Scripts\gtabview filename_or_table_uri

because

gtabview filename_or_table_uri

raises

`gtabview` not recognized as an internal or external command, operable program or batch file.

tabview encounters same problem.

it will be nice if we could have gtabview directly executable under Windows

Kind regards

PS:

#!/usr/bin/env python
# -*- coding: utf-8 -*-
# gtabview: a simple graphical tabular data viewer
# Copyright(c) 2014-2015: wave++ "Yuri D'Elia" <wavexx@thregr.org>
# Copyright(c) 2014-2015: Scott Hansen <firecat4153@gmail.com>
# Distributed under the MIT license (see LICENSE) WITHOUT ANY WARRANTY.

to

#!C:\Anaconda3\python.exe
# -*- coding: utf-8 -*-
# gtabview: a simple graphical tabular data viewer
# Copyright(c) 2014-2015: wave++ "Yuri D'Elia" <wavexx@thregr.org>
# Copyright(c) 2014-2015: Scott Hansen <firecat4153@gmail.com>
# Distributed under the MIT license (see LICENSE) WITHOUT ANY WARRANTY.
s-celles commented 9 years ago

Maybe we should add a console_script entry_points to setup.py see http://stackoverflow.com/questions/774824/explain-python-entry-points

s-celles commented 9 years ago

Here is a comparison between cmd and "Git Shell" (MinGW in fact)

gtabview_run_script

wavexx commented 9 years ago

The question is: does console_script actually build a wrapper .exe also for pre-existing scripts? All the examples I've seen require a module/function for which a wrapper is built.

s-celles commented 9 years ago

I noticed a lot of exe files in this Script directory aside .py script files. An idea could be to have a look at some and look at the setup.py file in their respective project

sprintae86 commented 9 years ago

In my Windows 7 Python 2.7 installation command line python apps usually come with a batch file in the Scripts directory to get them started. e.g. scapy, spyder, editra, etc. So, using scapy as the example, addition of a simple gtabview.bat file in the "\Scripts" directory with:

@REM Use Python to run the gtabview script from the current directory, passing all parameters @python %~dp0\gtabview %*

Seems to execute gtabview from the Windows CMD line.

wavexx commented 9 years ago

Do they simply call python? (I guess they assume python was set into the path).

I do use some wrapper scripts as well, but I instead use some abomination with a temporary script to discover the python installation path without python.exe requiring to be in path. I'd avoid /gladly/ to use that if that's the norm...

sprintae86 commented 9 years ago

Hmm,

21 bat files installed in my Python Scripts directory. A couple used the format already mentioned. Others used a variation something like ...

@echo off

start "" "C:\Python27\pythonw.exe" "C:\Python27\Scripts\editra" %1 %2 %3 %4 %5 %6 %7 %8 %9

Starting either python.exe or pythonw.exe. Unfortunately, I'm no expert (in Windows Batch scripting or Python) so cannot suggest the 'preferred' solution. Author's choice maybe?

s-celles commented 8 years ago

Great doc available here http://python-packaging.readthedocs.org/en/latest/command-line-scripts.html

wavexx commented 8 years ago

@sprintae86: can you give it a shot?

I don't have a windows setup to test it right now (I generally have to ask a colleague).