Really annoying thread properties 

This sucks monkey ass, mainly because I didn’t think of that before. And that’s just one example why multi-threaded (soon to be -processing, probably) applications are hard.

[code]import subprocess as sp
import time
import os
from threading import Thread

class MyThread(Thread):

def __init__(self, mydir):
super().__init__()
self.mydir = mydir

def run(self):
os.chdir(self.mydir)
time.sleep(2)
print("I’m (%s) in directory %s"
% (str(self), os.getcwd()))

if __name__ == "__main__":
MyThread("/tmp").start()
time.sleep(1)
MyThread("/").start()
[/code]

Result is:

[code]I’m (<MyThread(Thread-1, started 140195858716416)>) in directory /
I’m (<MyThread(Thread-2, started 140195850323712)>) in directory /[/code]