[Swift-user] readData is treating line as a single field

Yadu Nand yadudoc1729 at gmail.com
Mon Jan 13 14:31:37 CST 2014


Glad to hear that this isn't blocking you anymore.

-Yadu-


On Mon, Jan 13, 2014 at 2:23 PM, Ketan Maheshwari <ketan at mcs.anl.gov> wrote:

> I found that the problem was a misplaced space in one of the paths in my
> original file used for the run. Removing the space fixed the issue.
>
> While trying to debug/reproduce, I found that readData() works with tabs,
> multiple spaces, combination of tabs and spaces and irregular number of
> spaces between fields.
>
>
> On Mon, Jan 13, 2014 at 1:48 PM, Yadu Nand <yadudoc1729 at gmail.com> wrote:
>
>> Hi Ketan,
>>
>> Could you give me a sample file and code you're using to test this out ?
>>
>> -Yadu
>>
>>
>> On Mon, Jan 13, 2014 at 11:46 AM, Ketan Maheshwari <ketan at mcs.anl.gov>wrote:
>>
>>> Hi Mike,
>>>
>>> I am not sure how to introduce a field separator to readData(). I tried
>>> adding '|' between header and data fields but seems readData is complaining
>>> that file header does not match type and it expected space separated items:
>>>
>>> File header does not match type. Expected 4 whitespace separated items.
>>> Got 5 instead.
>>> swiftscript:readData, quadui-multi.swift, line 27
>>>
>>>
>>>
>>> On Mon, Jan 13, 2014 at 11:05 AM, Wilde, Michael J. <wilde at mcs.anl.gov>wrote:
>>>
>>>>  Did you try different field separators? I think in the past Ive used
>>>> spaces. Perhaps the readData() code is not sufficiently white-space-aware
>>>> yet?
>>>>
>>>>  - Mike
>>>>
>>>>
>>>>  --
>>>> Michael Wilde
>>>> Mathematics and Computer Science          Computation Institute
>>>> Argonne National Laboratory                    The University of Chicago
>>>>
>>>>     ------------------------------
>>>> *From:* swift-user-bounces at ci.uchicago.edu [
>>>> swift-user-bounces at ci.uchicago.edu] on behalf of Ketan Maheshwari [
>>>> ketan at mcs.anl.gov]
>>>> *Sent:* Monday, January 13, 2014 11:01 AM
>>>> *To:* Swift User
>>>> *Subject:* [Swift-user] readData is treating line as a single field
>>>>
>>>>   Hi,
>>>>
>>>>  I am trying to use readData() function in Swift to read fields into a
>>>> Swift structure but seems it is reading the whole line as a single field.
>>>>
>>>>  Here is my text file for the data:
>>>>
>>>>  $ cat data.txt
>>>> Survey_data Strategy_data Field_data quadui_outdir
>>>> /home/kcm92/faceit-pipeline/FIXED_ACE_DOME/ACCESS1/4.5/MID/EMBU/Survey_data_import_fixed.zip
>>>> /home/kcm92/faceit-pipeline/FIXED_ACE_DOME/ACCESS1/4.5/MID/EMBU/Seasonal_strategy_fixed.zip
>>>>  /home/kcm92/faceit-pipeline/FIXED_ACE_DOME/ACCESS1/4.5/MID/EMBU/Field_Overlay_fixed.zip
>>>> /home/kcm92/outdir_1
>>>> /home/kcm92/faceit-pipeline/FIXED_ACE_DOME/ACCESS1/4.5/MID/ISHIARA/Survey_data_import_fixed.zip
>>>> /home/kcm92/faceit-pipeline/FIXED_ACE_DOME/ACCESS1/4.5/MID/ISHIARA/Seasonal_strategy_fixed.zip
>>>> /home/kcm92/faceit-pipeline/FIXED_ACE_DOME/ACCESS1/4.5/MID/ISHIARA/Field_Overlay_fixed.zip
>>>> /home/kcm92/outdir_2
>>>>
>>>>  I have 4 fields and 2 rows.
>>>>
>>>>  Here is the structure definition:
>>>>
>>>>  type Data{
>>>>     string Survey_data;
>>>>     string Field_data;
>>>>     string Strategy_data;
>>>>     string quadui_outdir;
>>>> }
>>>>
>>>>  Here is the Swift loop that I am using to process this data:
>>>>
>>>>  Data d[] = readData(@arg("data"));
>>>> /* run quadui */
>>>> foreach ditem in d{
>>>> tracef("Survey data is: %s", ditem.Survey_data);
>>>>  }
>>>>
>>>>  In the output, I get the whole first row of the file instead of the
>>>> expected first field.
>>>>
>>>>  Any clues?
>>>>
>>>>  Thanks,
>>>> Ketan
>>>>
>>>
>>>
>>> _______________________________________________
>>> Swift-user mailing list
>>> Swift-user at ci.uchicago.edu
>>> https://lists.ci.uchicago.edu/cgi-bin/mailman/listinfo/swift-user
>>>
>>
>>
>>
>> --
>> Yadu Nand B
>>
>>
>> _______________________________________________
>> Swift-user mailing list
>> Swift-user at ci.uchicago.edu
>> https://lists.ci.uchicago.edu/cgi-bin/mailman/listinfo/swift-user
>>
>
>


-- 
Yadu Nand B
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/swift-user/attachments/20140113/46ec75cf/attachment.html>


More information about the Swift-user mailing list