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

VBA returns old error #1158

Closed
mfreak95 opened this issue Oct 11, 2019 · 3 comments · Fixed by #1204
Closed

VBA returns old error #1158

mfreak95 opened this issue Oct 11, 2019 · 3 comments · Fixed by #1204
Labels
bug
Milestone

Comments

@mfreak95
Copy link

@mfreak95 mfreak95 commented Oct 11, 2019

Windows 10

XLwings 15.9, Excel Office 365, Python 3.7

The issue i have is that after i run a par of code that gives an error, when i solve the issue in either python or VBA and rerun the code exactly the same error is given. To me it seems like the python environment sticks in this old error. And it does not take the new code. Any solutions for this?

 File "<string>", line 1

    import sys, os; sys.path[0:0]=os.path.normcase(os.path.expandvars(r'C:\Users\Mark Buis\OneDrive - Focus Orange Advisory B.V;C:\Users\Mark Buis\OneDrive - Focus Orange Advisory B.V\TickerIDRetriever.zip;')).split(';'); import hello2; hello2.scrapeAndPrint(ALX:AEX1)

                                                                                                                                                                                                                                                                      ^

SyntaxError: invalid syntax

VBA:

Sub getInfoTickerIDS()
    Dim i As Integer
    Dim IDArray
    IDS = getAmountOfIDS()
    IDArray = Range("A6:A" & (IDS + 5)).Value
    Sheets("Dashboard").Range("C2:C3").Value = IDArray
    
    For i = 1 To IDS
        ID = IDArray(i, 1)
        Sheets("Dashboard").Range("E2").Value = ID
        RunPython ("import hello2; hello2.scrapeAndPrint(" & ID & "," & i & ")")
    Next i
    
End Sub
@fzumstein fzumstein added the bug label Oct 11, 2019
@fzumstein

This comment has been minimized.

Copy link
Member

@fzumstein fzumstein commented Oct 11, 2019

This seems to be an issue when Windows sometimes locks the log file which is being read back for the error handling so the error isn't properly cleared.

@mfreak95

This comment has been minimized.

Copy link
Author

@mfreak95 mfreak95 commented Oct 11, 2019

Is there anyway to work around this or do i have to live with it?

@fzumstein

This comment has been minimized.

Copy link
Member

@fzumstein fzumstein commented Oct 11, 2019

Until this is properly fixed, you could just make sure that the log file is deleted when you suspect this behaviour. You'll find the log file here: http://docs.xlwings.org/en/stable/addin.html#log-file-default-locations

Changing the location might also help or make it easier at least to delete manually if need be.

@fzumstein fzumstein added this to the 0.16.3 milestone Dec 10, 2019
fzumstein added a commit that referenced this issue Dec 11, 2019
…ld error was shown, closes #1158
fzumstein added a commit that referenced this issue Dec 12, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.