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

Change in the Current Work Directory during initialisation bug #3

Open
lsrosa opened this issue Oct 21, 2020 · 0 comments
Open

Change in the Current Work Directory during initialisation bug #3

lsrosa opened this issue Oct 21, 2020 · 0 comments
Labels
bug Something isn't working

Comments

@lsrosa
Copy link

lsrosa commented Oct 21, 2020

Following the code:

1.     #%% Start Mustard
2.     cwd = os.getcwd()
3.     import threading
4.     import mustard
5.     app = mustard.Mustard()
6.     thread = threading.Thread(target=app.run)
7.     thread.daemon = True
8.     thread.start()
9.
10.    #%% Once mustard is open, undo the change of working directory
11.    os.chdir(cwd)
12.    del cwd

It saves the current work dir (cdw) (line 2), and starts mustard (lines 3 to 8). After that it resets the cwd (lines 10 to 12).

On line 10 there is this code block separator. If I try to run the two blocks together, it bugs. If I run the first, it finishes loading mustard without problems, then I run the second without problems.

Seems like mustard is being initialized by a thread which is not locking the cwd, and it changes while loading, causing bugs.

Also, I am not clear why "import mustard" changes the cwd

@lsrosa lsrosa added the bug Something isn't working label Oct 21, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant