Skip to content
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

mac: Expand Environmental Variables #615

Closed
y2kbugger opened this issue Jan 19, 2017 · 19 comments
Closed

mac: Expand Environmental Variables #615

y2kbugger opened this issue Jan 19, 2017 · 19 comments

Comments

@y2kbugger
Copy link
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
Copy link
Member

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

@kaiaeberli
Copy link

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

@y2kbugger
Copy link
Contributor Author

I think that fails on Mac

@sdementen
Copy link
Contributor

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
Copy link
Member

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

@sdementen
Copy link
Contributor

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

@fzumstein
Copy link
Member

fzumstein commented May 14, 2018 via email

@sdementen
Copy link
Contributor

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
Copy link
Contributor

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
Copy link
Contributor

@fzumstein , do I prepare a PR for this ?

@fzumstein
Copy link
Member

fzumstein commented May 15, 2018 via email

@sdementen
Copy link
Contributor

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

@fzumstein
Copy link
Member

fzumstein commented May 15, 2018 via email

@sdementen
Copy link
Contributor

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

@sdementen
Copy link
Contributor

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

@fzumstein
Copy link
Member

fzumstein commented May 15, 2018 via email

@Brad-eki
Copy link

As far as I can tell this is solved (On Windows at least). Is that correct?

@fzumstein fzumstein changed the title Expand Environmental Variables mac: Expand Environmental Variables Mar 20, 2019
@fzumstein
Copy link
Member

fzumstein commented Mar 20, 2019

yes it's resolved on Windows, but the equivalent is still en issue on Mac, I've changed the title accordingly. On mac, we'd want ~ (not technically an env var) to be resolved correctly.

@Brad-eki
Copy link

Thanks for the correction. :D

@fzumstein fzumstein removed this from the short list milestone Aug 11, 2019
@fzumstein fzumstein added this to the 0.19.5 milestone Jul 4, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants