Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
picomon
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
Operations
Operations
Incidents
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
arn
picomon
Commits
234942a6
Commit
234942a6
authored
Aug 29, 2014
by
Jonathan Michalon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
import_config: disable bytecode writing in case directory is RO
parent
d7d493c2
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
6 deletions
+10
-6
picomon/__main__.py
picomon/__main__.py
+10
-6
No files found.
picomon/__main__.py
View file @
234942a6
...
...
@@ -12,7 +12,6 @@ import concurrent.futures
import
signal
import
argparse
import
logging
import
importlib
import
sys
import
os
from
time
import
sleep
...
...
@@ -73,12 +72,17 @@ def parse_args():
def
import_config
(
configfile
):
# import config file module
""" import config file module """
# narrow importlib usage and avoid bytecode writing to be able to use
# configfiles in RO directories
from
importlib
import
import_module
sys
.
dont_write_bytecode
=
True
sys
.
path
.
append
(
os
.
path
.
dirname
(
configfile
))
filename
=
os
.
path
.
basename
(
configfile
)
base
,
ext
=
os
.
path
.
splitext
(
filename
)
try
:
sys
.
path
.
append
(
os
.
path
.
dirname
(
configfile
))
filename
=
os
.
path
.
basename
(
configfile
)
base
,
ext
=
os
.
path
.
splitext
(
filename
)
importlib
.
import_module
(
base
)
import_module
(
base
)
except
ImportError
as
e
:
logging
.
critical
(
"Cannot load config from '%s': %s"
%
(
args
.
config
,
str
(
e
)))
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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