New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expand Environmental Variables #615

Open
y2kbugger opened this Issue Jan 19, 2017 · 16 comments

Comments

Projects
None yet
4 participants
@y2kbugger
Contributor

y2kbugger commented Jan 19, 2017

So from the time I submitted the last pull request until now, I have been hard coding the address for each user.

Now finally trying to use the feature again in 10.1:

PYTHON_WIN = "%LOCALAPPDATA%\Continuum\Miniconda3\envs\pydev\pythonw.exe"

yields:

 Could not load xlwings32.dll from either of the following folders: %LOCALAPPDATA%\Continuum\Miniconda3\envs\pydev, %LOCALAPPDATA%\Continuum\Miniconda3\envs

Since it has been so long I don't know when the regression happened. I figured you may know the answer right away before I dig in and attempt a fix.

@fzumstein fzumstein added the bug label Jan 19, 2017

@fzumstein fzumstein added this to the short list milestone Jan 19, 2017

@fzumstein

This comment has been minimized.

Member

fzumstein commented Jan 19, 2017

Nope, can't say off the top of my head what could be causing it, but I found this related error: #616

@kaiaeberli

This comment has been minimized.

kaiaeberli commented May 11, 2017

how about using this: PYTHON_WIN = Environ("LOCALAPPDATA") + rest

@y2kbugger

This comment has been minimized.

Contributor

y2kbugger commented May 12, 2017

I think that fails on Mac

@sdementen

This comment has been minimized.

Contributor

sdementen commented May 14, 2018

Could we use on windows http://www.robvanderwoude.com/vbstech_data_environment.php#WSHShell to expand the environment variables ?
I have a use case too for an excel tool stored on a shared drive but using a local python install (via pipenv) that is stored in the %HOME%/.virtualenvs so I would like to have in the xlwings.conf the value "%HOME%/.virtualenvs" for INTERPRETER

@fzumstein

This comment has been minimized.

Member

fzumstein commented May 14, 2018

we had this working once: #358 so we should just be able to see what broke it

@sdementen

This comment has been minimized.

Contributor

sdementen commented May 14, 2018

ok, so theoretically it should work but there is a bug to hunt, correct understanding from my part?

@fzumstein

This comment has been minimized.

Member

fzumstein commented May 14, 2018

@sdementen

This comment has been minimized.

Contributor

sdementen commented May 14, 2018

but I see the expand only in the Function ReadFile(ByVal FileName As String).
It should be at least called when assigning in PYTHON_WIN = GetConfig("INTERPRETER", "pythonw") ==> so probably best to do the expand in the GetConfig, no ?

@sdementen

This comment has been minimized.

Contributor

sdementen commented May 14, 2018

I have added at the end of the GetConfig function:

    ' Defaults
    If GetConfig = "" Then
        GetConfig = default
    End If
    
    ' Expand environement variables
    GetConfig = ExpandEnvironmentVariables(GetConfig)
End Function

with the function ExpandEnvironmentVariables doing the objShell.ExpandEnvironmentStrings magic and it works (ie the INTERPRETER is properly expanded)

@sdementen

This comment has been minimized.

Contributor

sdementen commented May 15, 2018

@fzumstein , do I prepare a PR for this ?

@fzumstein

This comment has been minimized.

Member

fzumstein commented May 15, 2018

@sdementen

This comment has been minimized.

Contributor

sdementen commented May 15, 2018

when I fork from origin/master, I do not see the xlwings.bas. Should I just modify the .xlam and push it ?

@fzumstein

This comment has been minimized.

Member

fzumstein commented May 15, 2018

@sdementen

This comment has been minimized.

Contributor

sdementen commented May 15, 2018

ok, is there the equivalent of "expanding environment variables" under Mac ? is it what ToMacPath does ?

@sdementen

This comment has been minimized.

Contributor

sdementen commented May 15, 2018

btw, how can I see the change of xlwings.xlam with xltrail?

@fzumstein

This comment has been minimized.

Member

fzumstein commented May 15, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment