Closed jmshapir closed 6 years ago
@jmshapir In the config_global.yaml
in \Users\jshapir1\Documents\GitHub\Skills\paper_slides\
, can you try changing the executable_names
for lyx to lyx
? E.g
@DavidRitzwoller
Thanks @jmshapir. Returning to the logic of is_in_path
, lets see if os
is able to interact with your path environment variable in the way we expect it to.
Would you mind opening an interactive python
or ipython
session and sending the output of the following two scripts?
os
is able to access your path environment variable, and further what it looks like. import os
user_path = os.environ['PATH'].split(os.pathsep)
print user_path
When I execute this I see
exe = []
for path in os.environ['PATH'].split(os.pathsep):
path = path.strip("'")
exe_temp = os.path.join(path, "lyx")
if os.access(exe_temp, os.X_OK):
exe.append(exe_temp)
print exe
When I execute this I see
@DavidRitzwoller 1.
>>> import os
>>>
>>> user_path = os.environ['PATH'].split(os.pathsep)
>>> print user_path
['C:\\Program Files (x86)\\Intel\\iCLS Client\\', 'C:\\Program Files\\Intel\\iCLS Client\\', 'C:\\WINDOWS\\system32', 'C:\\WINDOWS', 'C:\\WINDOWS\\System32\\Wbem', 'C:\\WINDOWS\\System32\\WindowsPowerShell\\v1.0\\', 'C:\\Program Files\\Intel\\WiFi\\bin\\', 'C:\\Program Files\\Common Files\\Intel\\WirelessCommon\\', 'C:\\Program Files (x86)\\PuTTY\\', 'C:\\Program Files (x86)\\MiKTeX 2.9\\miktex\\bin\\', 'C:\\Program Files (x86)\\LyX 2.2\\Perl\\bin', 'C:\\Program Files (x86)\\Putty', 'C:\\Program Files (x86)\\LyX 2.2\\bin\\', 'C:\\Program Files (x86)\\MikTex 2.9\\', 'C:\\Python27\\', 'C:\\Program Files\\Git\\cmd', 'C:\\Program Files\\MiKTeX 2.9\\miktex\\bin\\x64\\', 'C:\\Program Files (x86)\\LyX 2.3\\Perl\\bin', 'C:\\Program Files (x86)\\Intel\\Intel(R) Management Engine Components\\DAL', 'C:\\Program Files\\Intel\\Intel(R) Management Engine Components\\DAL', 'C:\\Program Files (x86)\\Intel\\Intel(R) Management Engine Components\\IPT', 'C:\\Program Files\\Intel\\Intel(R) Management Engine Components\\IPT', 'C:\\Python27\\Scripts', 'C:\\Users\\jshapir1\\AppData\\Local\\Microsoft\\WindowsApps', 'C:\\Users\\jshapir1\\AppData\\Local\\GitHubDesktop\\bin']
2.
>>> exe = []
>>> for path in os.environ['PATH'].split(os.pathsep):
... path = path.strip("'")
... exe_temp = os.path.join(path, "lyx")
... if os.access(exe_temp, os.X_OK):
... exe.append(exe_temp)
... print exe
File "<stdin>", line 6
print exe
^
SyntaxError: invalid syntax
Thanks @jmshapir.
import os
exe = [] for path in os.environ['PATH'].split(os.pathsep): path = path.strip("'") exe_temp = os.path.join(path, "lyx") if os.access(exe_temp, os.X_OK): exe.append(exe_temp)
print exe
EDIT:
3. Can you send me screenshots of the contents of the directories?
C:\Program Files (x86)\LyX 2.2\Perl\bin C:\Program Files (x86)\LyX 2.2\bin\ C:\Program Files (x86)\LyX 2.3\Perl\bin
@DavidRitzwoller we are now on a different Windows PC. (But it gets the same error when scanning for LyX).
1 and 2:
C:\Users\jshapir1\Documents\GitHub\Skills\paper_slides>python
Python 2.7.13 (v2.7.13:a06454b1afa1, Dec 17 2016, 20:42:59) [MSC v.1500 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import os
>>>
>>> user_path = os.environ['PATH'].split(os.pathsep)
>>> print user_path
['C:\\ProgramData\\Oracle\\Java\\javapath', 'C:\\windows\\SYSTEM32', 'C:\\windows', 'C:\\windows\\SYSTEM32\\WBEM', 'C:\\windo
ws\\System32\\WindowsPowerShell\\v1.0\\', 'C:\\windows\\System32\\WindowsPowerShell\\v1.0\\', 'C:\\Program Files (x86)\\ATI T
echnologies\\ATI.ACE\\Core-Static', 'C:\\Program Files\\Intel\\WiFi\\bin\\', 'C:\\Program Files\\Common Files\\Intel\\Wireles
sCommon\\', 'C:\\Program Files (x86)\\Intel\\OpenCL SDK\\3.0\\bin\\x86', 'C:\\Program Files (x86)\\Intel\\OpenCL SDK\\3.0\\bi
n\\x64', 'C:\\Program Files (x86)\\MiKTeX 2.9\\miktex\\bin\\', 'C:\\Program Files (x86)\\LyX 2.1\\bin', 'C:\\Program Files (x
86)\\LyX 2.1\\Perl\\bin', 'C:\\Python27\\', 'C:\\Python27\\Scripts', 'C:\\Program Files\\Git LFS', 'C:\\windows\\System32\\Wi
ndowsPowerShell\\v1.0\\', 'C:\\Program Files (x86)\\PuTTY', 'C:\\Program Files\\Git\\cmd', 'C:\\Program Files (x86)\\LyX 2.2\
\Perl\\bin', 'C:\\Program Files (x86)\\LyX 2.3\\Perl\\bin', 'C:\\Program Files\\Intel\\WiFi\\bin\\', 'C:\\Program Files\\Comm
on Files\\Intel\\WirelessCommon\\', 'C:\\Program Files (x86)\\PuTTY', 'C:\\Users\\jshapir1\\AppData\\Local\\GitHubDesktop\\bi
n']
>>> import os
>>>
>>> exe = []
>>> for path in os.environ['PATH'].split(os.pathsep):
... path = path.strip("'")
... exe_temp = os.path.join(path, "lyx")
... if os.access(exe_temp, os.X_OK):
... exe.append(exe_temp)
...
>>> print exe
[]
>>>
3.
@jmshapir I think I see whats going on.
On MacOS, we can check that we have access to the executable for lyx
by checking if we have access to a file named lyx
in each of the directories on our path. On Windows, I believe we will need to search to see if we have access to lyx.exe
instead. Can you try the following?
import os
exe = []
for path in os.environ['PATH'].split(os.pathsep):
path = path.strip("'")
exe_temp = os.path.join(path, "lyx.exe")
if os.access(exe_temp, os.X_OK):
exe.append(exe_temp)
print exe
@DavidRitzwoller
>>> import os
>>>
>>> exe = []
>>> for path in os.environ['PATH'].split(os.pathsep):
... path = path.strip("'")
... exe_temp = os.path.join(path, "lyx.exe")
... if os.access(exe_temp, os.X_OK):
... exe.append(exe_temp)
...
>>> print exe
['C:\\Program Files (x86)\\LyX 2.1\\bin\\lyx.exe']
@jmshapir Great! I'll edit is_in_path
to loop over both lyx
and lyx.exe
. That should get things working.
@jmshapir Here's a short term fix until the branchdev_4.1.3
is merged to master
.
In the config_global.yaml
in paper_slides, set prereq_checks:
for lyx to No. E.g
If you don't want to turn off the prereq_check
, the function is_in_path
can be changed to
def is_in_path(program):
'''
This general helper function checks whether `program` exists in the
user's path environment variable.
'''
if os.access(program, os.X_OK):
return program
else:
for path in os.environ['PATH'].split(os.pathsep):
path = path.strip("'")
exe = os.path.join(path, program)
if os.access(exe, os.X_OK):
return exe
exe = os.path.join(path, program + ".exe")
if os.access(exe, os.X_OK):
return exe
return False
and error should be resolved.
Thanks @DavidRitzwoller. Already turned off lyx-checking in the global config as a short-term fix. Thanks!
Summary: In this issue, gslab_python was augmented to search for prerequisites on Windows operating systems. PR at #163.
I'm getting the error that LyX isn't on my path even though it is. (Example below.)
It could be an issue with how my path is set up. (I am on Windows.)
Can you give me a rough sense of the logic that the
is_in_path
function is using to find whether "lyx" is on path?That might give us a clue about the source of the issue.