Changeset 2248


Ignore:
Timestamp:
Feb 3, 2010 10:44:59 AM (10 years ago)
Author:
jwatson
Message:

Adding os.path.expanduser wrappers around all directory/filenames, to facilitate correct processing of ~ characters.

Location:
coopr.pysp/trunk/coopr/pysp
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • coopr.pysp/trunk/coopr/pysp/ef_writer_script.py

    r1979 r2248  
    8484      risk_alpha = options.risk_alpha
    8585
    86    write_ef_from_scratch(options.model_directory, options.instance_directory, options.output_file, \
     86   write_ef_from_scratch(os.path.expanduser(options.model_directory), os.path.expanduser(options.instance_directory), os.path.expanduser(options.output_file), \
    8787                         generate_weighted_cvar, cvar_weight, risk_alpha)
    8888
  • coopr.pysp/trunk/coopr/pysp/ph.py

    r2201 r2248  
    10621062         if self._output_solver_results is True:
    10631063            print "Results for scenario=",scenario_name
    1064             results.write(num=1)           
     1064            results.write(num=1)
    10651065
    10661066         start_time = time.time()
  • coopr.pysp/trunk/coopr/pysp/ph_script.py

    r2154 r2248  
    292292      # we need to load the reference model, as pickle doesn't save contents of .py files!
    293293      try:
    294          reference_model_filename = options.model_directory+os.sep+"ReferenceModel.py"
     294         reference_model_filename = os.path.expanduser(options.model_directory)+os.sep+"ReferenceModel.py"
    295295         if options.verbose is True:
    296296            print "Scenario reference model filename="+reference_model_filename
     
    336336
    337337      try:
    338          reference_model_filename = options.model_directory+os.sep+"ReferenceModel.py"
     338         reference_model_filename = os.path.expanduser(options.model_directory)+os.sep+"ReferenceModel.py"
    339339         if options.verbose is True:
    340340            print "Scenario reference model filename="+reference_model_filename
     
    356356
    357357      try:
    358          reference_instance_filename = options.instance_directory+os.sep+"ReferenceModel.dat"
     358         reference_instance_filename = os.path.expanduser(options.instance_directory)+os.sep+"ReferenceModel.dat"
    359359         if options.verbose is True:
    360360            print "Scenario reference instance filename="+reference_instance_filename
     
    372372
    373373      try:
    374          scenario_tree_instance_filename = options.instance_directory+os.sep+"ScenarioStructure.dat"
     374         scenario_tree_instance_filename = os.path.expanduser(options.instance_directory)+os.sep+"ScenarioStructure.dat"
    375375         if options.verbose is True:
    376376            print "Scenario tree instance filename="+scenario_tree_instance_filename
     
    492492                              checkpoint_interval=options.checkpoint_interval)
    493493   
    494       ph.initialize(scenario_data_directory_name=options.instance_directory, \
     494      ph.initialize(scenario_data_directory_name=os.path.expanduser(options.instance_directory), \
    495495                    model=reference_model, \
    496496                    model_instance=reference_instance, \
     
    528528      print "Writing EF for remainder problem"
    529529      print ""
    530       write_ef(ph._scenario_tree, ph._instances, options.ef_output_file)
     530      write_ef(ph._scenario_tree, ph._instances, os.path.expanduser(options.ef_output_file))
    531531
    532532   #
     
    535535   if options.solve_ef is True:
    536536      print ""
    537       print "Solving extensive form written to file="+options.ef_output_file
     537      print "Solving extensive form written to file="+os.path.expanduser(options.ef_output_file)
    538538      print ""
    539539
     
    555555
    556556      print "Queuing extensive form solve"
    557       ef_action_handle = ef_solver_manager.queue(options.ef_output_file, opt=ef_solver, warmstart=False, tee=options.output_ef_solver_log)
     557      ef_action_handle = ef_solver_manager.queue(os.path.expanduser(options.ef_output_file), opt=ef_solver, warmstart=False, tee=options.output_ef_solver_log)
    558558      print "Waiting for extensive form solve"
    559559      ef_results = ef_solver_manager.wait_for(ef_action_handle)
Note: See TracChangeset for help on using the changeset viewer.