ratt-ru / pyxis

Python Extensions for Interferometry Scripting
3 stars 5 forks source link

Fail to write log output #103

Closed matthieutrs closed 4 years ago

matthieutrs commented 4 years ago

Hello,

This issue follow the resolution of #101 and the building of Pyxis from source. When loading some pyxis-smh.py/pyxis-smh.conf files, I get the following error message:

2020/07/14 17:27:44 INFO: redirecting log output to ./log-test.txt
Traceback (most recent call last):
  File ".../software/pyxis/latest/bin/pyxis", line 45, in <module>
    from Pyxis.Commands import _info as info
  File ".../software/pyxis/latest/lib/python3.6/site-packages/Pyxis/__init__.py", line 68, in <module>
    Pyxis.Internals.initconf();
  File ".../software/pyxis/latest/lib/python3.6/site-packages/Pyxis/Internals.py", line 780, in initconf
    assign_templates();
  File ".../software/pyxis/latest/lib/python3.6/site-packages/Pyxis/Internals.py", line 683, in assign_templates
    set_logfile(Pyxis.Context.get('LOG',None));
  File ".../software/pyxis/latest/lib/python3.6/site-packages/Pyxis/Internals.py", line 739, in set_logfile
    _current_logobj = sys.stdout = sys.stderr = open(filename,mode);
ValueError: must have exactly one of create/read/write/append mode 

Would you have any hint on how to solve this?

matthieutrs commented 4 years ago

@adrianjhpc solved this by changing mode="wa" to mode="a" in Pyxis/Internals.py.

o-smirnov commented 4 years ago

Yep, I was about to push the same change to the issue-101 branch. But I'd like to sort out #102 while I'm at it...

o-smirnov commented 4 years ago

@matthieutrs, would you please let us know when you think all your previous scripts are working? We'll make a point release then.

matthieutrs commented 4 years ago

@o-smirnov we had to do 1 last change here: Pyxis.Context[mod] = sys.modules.get(mod,sys.modules.get("Pyxides."+m)); was replaced by Pyxis.Context[mod] = sys.modules.get(mod,sys.modules.get("Pyxides."+mod)); Our installation of Pyxis from source now works like a charm!

o-smirnov commented 4 years ago

Ah thanks. Now that was a genuine old-time bug that moving to a new Python exposed.