Skip to content

TypeError: argument tablename must be a string #25

Open

Description

@SBrownson

e.g. when running
export_uvtable('uvtable.txt',
tb,
vis= 'test.ms')

produces error:
/Applications/CASA.app/Contents/Frameworks/Python.framework/Versions/2.7/lib/python2.7/io.py in export_uvtable(uvtable_filename, tb, vis, split_args, split, dualpol, fmt, datacolumn, keep_tmp_ms, verbose)

/Applications/CASA.app/Contents/Resources/python/casac/table.pyc in open(self, *args, **kwargs)
453
454 """
--> 455 return _table.table_open(self, *args, **kwargs)
456
457

TypeError: argument tablename must be a string

Activity

  1. mtazzari commented on Apr 25, 2018

    @mtazzari
    Owner

    I tried on CASA 4.7.0 and I am not able to reproduce the error.
    I run

    from uvplot import export_uvtable
    export_uvtable('uvtable.txt',
    tb,
    vis= 'test.ms')

    and I got no error.

    Have you tried typing the command manually instead of copy-pasting it?
    Which version of CASA are you using?

  2. mtazzari commented on Apr 26, 2018

    @mtazzari
    Owner

    I am trying it out with CASA 5.1.

    In the meanwhile, try adding a str() command such as vis=str('test.ms'). Do you still get the error?

    Could you give more details on how you use the script?
    I.e. a minimum working example and how you run it in CASA.

  3. SBrownson commented on Apr 26, 2018

    @SBrownson
    Author

    It seems
    from __future__ import (unicode_literals)
    in my script was producing the error.

    from uvplot import export_uvtable export_uvtable('uvtable.txt', tb, vis= 'test.ms')
    now runs smoothly.

    I note a new error,
    export_uvtable('uvtable.txt', tb, split=split, split_args = {'vis': 'test.ms', 'outputvis': 'new.ms', 'datacolumn':'DATA', 'spw': '0'})

    produces 'datacolumn CORRECTED_DATA is not available.'
    This seems strange given that DATA column was asked for explicitly. Also,
    export_uvtable('uvtable.txt', tb, 'test.ms', datacolumn= 'DATA')
    produces no such error.
    Note, 'test.ms' only has one spw - spw0

  4. mtazzari commented on Apr 26, 2018

    @mtazzari
    Owner

    Ok, so

    from __future__ import (unicode_literals)
    

    was the responsible for the error about the string. It's fine not to use it.

    Re the datacolumn error: datacolumn is not only a keyword in the split_arg dictionary, but is also a parameter of the export_uvtable function itself, which by default is set to CORRECTED_DATA: as a consequence, if you pass only datacolumn in the split_args dict, by default datacolumn will be CORRECTED_DATA anyway.
    This is a bug that I should fix in future release.

    For the time being, there are two viable options:

    1. if split_args=None, datacolumn can be provided,
    export_uvtable('uvtable.txt', tb, 'test.ms', datacolumn= 'DATA')
    1. if you specify split_args, then datacolumn outside the split_args must be set to the same value as inside split_args, e.g.:
    export_uvtable('uvtable.txt', tb, 'test.ms', datacolumn= 'DATA', split_args = {'vis': 'test.ms', 'outputvis': 'new.ms', 'datacolumn':'DATA', 'spw': '0'})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions