Comments (4)
Fixed for windows:
dcb590a
from stata_kernel.
Print notice to console if couldn't find path
from stata_kernel.
I usually do shutil.which
but you could try finding anything in the user's path that looks like "stata", right? Modified from this SO answer
from glob import glob
import os
def is_exe(fpath):
return os.path.isfile(fpath) and os.access(fpath, os.X_OK)
def which(program):
fpath, fname = os.path.split(program)
if fpath:
if is_exe(program):
return program
else:
matches = glob(program)
exe_list = []
for p in matches:
if is_exe(p):
exe_list += [p]
if len(exe_list) > 0:
return exe_list
else:
for path in os.environ["PATH"].split(os.pathsep):
exe_file = os.path.join(path, program)
if is_exe(exe_file):
return exe_file
exe_list = []
for path in os.environ["PATH"].split(os.pathsep):
exe_file = os.path.join(path, program)
matches = glob(exe_file)
for p in matches:
if is_exe(p):
exe_list += [p]
if len(exe_list) > 0:
return exe_list
return None
Then if which("stata")
returns None
, try which("stata*")
and then figure out a rule to parse that list (prefer names that match "stata15" or "stata15.*mp" and such).
from stata_kernel.
Yes, this would be helpful. I also want to try and search through the default save locations on Mac, where it's unlikely Stata will be on the user's path
from stata_kernel.
Related Issues (20)
- Graphs do not show with stata 17 HOT 5
- Graphs not displaying on JupyterLab with Stata 17 HOT 1
- Ubuntu run pytest get "stata_path option in configuration file is missing or invalid"
- Kernel does not recover after stata process is killed
- Atom and stata_kernel togther with Hydrogen -- not executing HOT 4
- Is stata kernel able to install in Mac OS? HOT 1
- Issues with stata_kernel in Atom (Hydrogen) HOT 3
- Graph display bug after setting user _graph_keywords? HOT 34
- Update kernel's python dependencies HOT 1
- Kernel does not execute then `*` is used within multi-line `syntax` statement
- Use importlib.resources instead of pkg_resources
- Repo modernization HOT 1
- How to make jupyter automatically close the stata session HOT 1
- %help magic does not work for Stata commands HOT 2
- The word "format" appears below stata plot output
- Graphs no longer display in Jupyter notebook HOT 9
- Kernel freezes whenever I try to run some code HOT 2
- can't run arch model. HOT 2
- How can i make the results more beautiful. HOT 2
- can we insert a graph on the local path using markdown?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from stata_kernel.