Skip to content

Commit

Permalink
fix generaton of the spectrum folder
Browse files Browse the repository at this point in the history
  • Loading branch information
davidsanchez committed Apr 3, 2018
1 parent 3049cc1 commit 04a134f
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion bin/enrico_plot_sed
@@ -1,12 +1,13 @@
#!/usr/bin/env python
"""Plot a SED"""
import sys
import sys,os
import numpy as np
from enrico.plotting import PlotSED,PlotUL,Params
from enrico.config import get_config
from enrico.utils import ReadResult,_SpecFileName

def plot(config):
os.system("mkdir -p "+config["out"]+"/Spectrum")
srcname = config['target']['name']
Emin = config['energy']['emin']
Emax = config['energy']['emax']
Expand Down

1 comment on commit 04a134f

@mireianievas
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of making calls to os.system, which I think is not really recommended, we could do a more pythonistic way

From: https://stackoverflow.com/questions/600268/mkdir-p-functionality-in-python

import errno    
import os

def mkdir_p(path):
    try:
        os.makedirs(path)
    except OSError as exc:  # Python >2.5
        if exc.errno == errno.EEXIST and os.path.isdir(path):
            pass
        else:
            raise

Please sign in to comment.