-
-
Notifications
You must be signed in to change notification settings - Fork 499
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
xlwings not working with OneDrive when the modules full folder location has a '-' in it #1891
Comments
@fzumstein Thanks for the quick update. I have installed the new version 0.27.6 but I am still having a similar issue. The Python code works fine when executed from VS Code and updating the workbook. ** All tests below were executed with the same working files.** Test 1 - Local files - PYTHONPATH folder contains a '_' and local
This setting works fine on clicking a button which calls a VBA function with a RunPython call. Test 2 - Local files - PYTHONPATH folder contains a '-' and local
This new setting - which only replaced '_' by '-' in the PYTHONPATH - raises an error:
Test 3 - Local files - PYTHONPATH folder contains a '-' and global
This setting works fine on clicking a button which calls a VBA function with a RunPython call. Conclusion: The issue appears only when there is a '-' in the Test 4 - OneDrive and local
This setting raises no error message but it runs very quickly and nothing happens. Test 5 - OneDrive and global
This setting works fine on clicking a button which calls a VBA function with a RunPython call. Conclusion: The issue with OneDrive is happening now because the OneDrive location has changed from Workaround A quick workaround for the issue in question is to use a global Further troubleshooting
|
So is your file structure the following?
|
@fzumstein yes, that is correct |
I can't replicate the issue with the dash in the folder name, so I think there's something else going on. I'd recommend you to set the configuration in the |
I am gonna check if I can modify the default OneDrive location otherwise gonna move to the sheet-based config files. Thanks |
I have changed the OneDrive location back to |
Just for the record to whoever happens to have the same issue. OneDrive changed the location back to I ended up using the sheet-based config files for OneDrive as recommended. Thanks to @fzumstein for the support. |
macOS Monterey / xlwings 0.27.5 / Excel Office 365 / Python 3.9.7
I managed to locally run a macro successfully but I am having issues to run the same macro from OneDrive. I just copied and pasted the excel file and the python files, nothing changed.
On troubleshooting, I noticed that if the local folder containing the python files includes a '-' in its name, I get a
modulenotfound
error even if it was normally working before. However, if I replace the '-' by a '_', it works normally.It happens that OneDrive changed its location from
/Users/abc/OneDrive
(xlwings used to work fine) to/Users/abc/Library/CloudStorage/OneDrive-Personal/
which contains a '-' and now I'm getting thismodulenotfound
error.I found a workaround which is to add the python folder to the PYTHONPATH in the addin - inside Excel- but it has some side effects as this environment variable is global and shared among all the workbooks. So, everytime I open a different workbook, I need to update PYTHONPATH.
Before, each workbook had its own
xlwings.conf
with its own PYTHONPATH and I had to set it up once instead of everytime I open another different workbook.I have tried several solutions from previous issues in github and stackoverflow but had no luck.
Any ideas on how to troubleshoot it further?
Thanks in advance
The text was updated successfully, but these errors were encountered: