1 |
-----BEGIN PGP SIGNED MESSAGE----- |
2 |
Hash: SHA256 |
3 |
|
4 |
On 10/11/14 00:24, Zac Medico wrote: |
5 |
> ir |
6 |
> + while current_dir != os.sep: |
7 |
> + try: |
8 |
> + st = os.stat(current_dir) |
9 |
> + except OSError as e: |
10 |
> + if errno == errno.ENOENT: |
11 |
> + current_dir = \ |
12 |
> + os.path.dirname(current_dir) |
13 |
> + continue |
14 |
> + break |
15 |
Can you think of a less terrible way of doing this in Python? |
16 |
|
17 |
(Serious question, not snark!) |
18 |
- -- |
19 |
Alexander |
20 |
bernalex@g.o |
21 |
https://secure.plaimi.net/~alexander |
22 |
-----BEGIN PGP SIGNATURE----- |
23 |
Version: GnuPG v2 |
24 |
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ |
25 |
|
26 |
iF4EAREIAAYFAlRgnQYACgkQRtClrXBQc7X7IgD+OlJhVIsqEoeQkrpJhQOTypoU |
27 |
uxOsZKj57wGO93cGwjQA/i5XAcFiQZz0ljLuZfSaG7rCXU5JtoMN7TDpi1HvF88O |
28 |
=U/sJ |
29 |
-----END PGP SIGNATURE----- |