Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
bob
bob.bio.face
Commits
882a6dad
Commit
882a6dad
authored
Nov 13, 2020
by
Yannick DAYER
Browse files
[fix] Get os environment variable correctly.
Tests if an os environment variable exists before using it.
parent
179c75a3
Pipeline
#45525
failed with stages
in 7 minutes and 20 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
bob/bio/face/config/baseline/gabor_graph.py
View file @
882a6dad
...
...
@@ -68,9 +68,11 @@ def get_pipeline(face_cropper, transform_extra_arguments):
)
# Set default temporary directory
default_temp
=
os
.
path
.
join
(
"/idiap"
,
"temp"
,
os
.
environ
[
"USER"
])
if
os
.
path
.
exists
(
default_temp
):
tempdir
=
os
.
path
.
join
(
default_temp
,
"bob_bio_base_tmp"
)
user_env_var
=
os
.
getenv
([
"USER"
],
None
)
if
user_env_var
:
default_temp
=
os
.
path
.
join
(
"/idiap"
,
"temp"
,
user_env_var
)
if
user_env_var
and
os
.
path
.
exists
(
default_temp
):
tempdir
=
os
.
path
.
join
(
default_temp
,
"bob_bio_base_tmp"
,
"gabor_graph"
)
else
:
# if /idiap/temp/<USER> does not exist, use /tmp/tmpxxxxxxxx
tempdir
=
tempfile
.
TemporaryDirectory
().
name
...
...
bob/bio/face/config/baseline/lda.py
View file @
882a6dad
...
...
@@ -42,9 +42,11 @@ def load(annotation_type, fixed_positions=None):
#### FEATURE EXTRACTOR ######
# Set default temporary directory
default_temp
=
os
.
path
.
join
(
"/idiap"
,
"temp"
,
os
.
environ
[
"USER"
])
if
os
.
path
.
exists
(
default_temp
):
tempdir
=
os
.
path
.
join
(
default_temp
,
"bob_bio_base_tmp"
)
user_env_var
=
os
.
getenv
([
"USER"
],
None
)
if
user_env_var
:
default_temp
=
os
.
path
.
join
(
"/idiap"
,
"temp"
,
user_env_var
)
if
user_env_var
and
os
.
path
.
exists
(
default_temp
):
tempdir
=
os
.
path
.
join
(
default_temp
,
"bob_bio_base_tmp"
,
"lda"
)
else
:
# if /idiap/temp/<USER> does not exist, use /tmp/tmpxxxxxxxx
tempdir
=
tempfile
.
TemporaryDirectory
().
name
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment