Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Supported by

Loop from file

Hi there!

I can't seem to generate my loop table from a UTF-8 csv file. When I attempt to quick-run or preview the table, I get the following error message:

    Failed to read text file: /var/folders/87/7y86f4p93bg484clz6jnny3w0000gn/T/tmpirWFfJ.opensesame_pool/food_trials.csv

    item-stack: experiment[run].practice_loop[run].block_sequence[run].block_loop[run]
    exception message: new-line character seen in unquoted field - do you need to open the file in universal-newline mode?
    time: Fri Nov  4 14:23:10 2016
    exception type: Error

    Traceback:
      File "/Applications/OpenSesame.app/Contents/Resources/lib/python2.7/site-packages/libopensesame/loop.py", line 202, in _create_live_datamatrix
        src_dm = io.readtxt(src)
      File "/Applications/OpenSesame.app/Contents/Resources/lib/python2.7/site-packages/python_datamatrix-0.3.0-py2.7.egg/datamatrix/io/_text.py", line 50, in readtxt
        for column in next(reader):
    Error: new-line character seen in unquoted field - do you need to open the file in universal-newline mode?

I'm also attaching my csv here.

Thanks!
-Jonathan

Comments

  • Hi everyone,

    I'm still not able to read from this file, but the error message has changed:

    Failed to read text file: /var/folders/87/7y86f4p93bg484clz6jnny3w0000gn/T/tmpBnfMsG.opensesame_pool/food_trials.csv

    item-stack:
    exception message:
    time: Sun Nov 6 20:29:29 2016
    exception type: StopIteration

    Traceback:
    File "/Applications/OpenSesame.app/Contents/Resources/lib/python2.7/site-packages/libopensesame/loop.py", line 202, in _create_live_datamatrix
    src_dm = io.readtxt(src)
    File "/Applications/OpenSesame.app/Contents/Resources/lib/python2.7/site-packages/python_datamatrix-0.3.0-py2.7.egg/datamatrix/io/_text.py", line 50, in readtxt
    for column in next(reader):
    StopIteration

    Has anyone had problems like the above when trying to loop from a csv file in OSX? Any insights?

    Thanks!
    -Jonathan

  • Hmmm... so I just re-saved my excel spreadsheet as a .csv (UTF-8) and it not works with the new file. Not sure what I changed :neutral:

    Sorry for the distraction!

  • Ahhhhhh I tried a new .csv (attached) and it went back to the same error message (I think -- I can't tell if this message is meaningfully different from the first one above). I know from the manual that csv's should be

    • plain-text
    • comma-separated
    • double-quoted (literal double-quotes are escaped with backward slashes)
    • UTF-8 encoded

    I think I've satisfied all of the above, but the error seems to have something to with the double-quoted requirement? The only newlines that occur in my .csv are for new rows. Nothing fancy (I think) between commas.

    Here's the error message:

    Failed to read text file: /var/folders/87/7y86f4p93bg484clz6jnny3w0000gn/T/tmpBnfMsG.opensesame_pool/factorial_food.csv

    item-stack:
    exception message: new-line character seen in unquoted field - do you need to open the file in universal-newline mode?
    time: Sun Nov 6 21:23:36 2016
    exception type: Error

    Traceback:
    File "/Applications/OpenSesame.app/Contents/Resources/lib/python2.7/site-packages/libopensesame/loop.py", line 202, in _create_live_datamatrix
    src_dm = io.readtxt(src)
    File "/Applications/OpenSesame.app/Contents/Resources/lib/python2.7/site-packages/python_datamatrix-0.3.0-py2.7.egg/datamatrix/io/_text.py", line 50, in readtxt
    for column in next(reader):
    Error: new-line character seen in unquoted field - do you need to open the file in universal-newline mode?

  • Hi,

    This is due to the line endings. Mac OS, Windows, and Linux use different characters to indicate the end of a line, and datamatrix cannot deal with the Mac OS end-of-line characters. I'll file a bug report on this. For now, you can simply do what you already did:

    • Use an .xlsx file instead; or
    • Convert the end of line characters in the .csv to Unix-style (how exactly depends on your text editor).

    Cheers and thanks for pointing this out!
    Sebastiaan

  • Thanks so much, Sebastiaan!

    Sorry, I should have mentioned this earlier, but I was persisting with the .csv because I had tried to use an .xlsx file and got the same error as this user, but when I entered the code you provided into the debug window and hit enter, it didn't seem to have any effect. I now think this was because I pasted both lines:

        import pip
        pip.main(['install', 'openpyxl'])
    

    and hit enter. When I entered just line 1 and hit enter, then just line 2 and hit enter, it worked! Probably something I should have known, but as I'm sure you can tell I'm a bit of a programming noob!

    Thanks again,
    -Jonathan

Sign In or Register to comment.

agen judi bola , sportbook, casino, togel, number game, singapore, tangkas, basket, slot, poker, dominoqq, agen bola. Semua permainan bisa dimainkan hanya dengan 1 ID. minimal deposit 50.000 ,- bonus cashback hingga 10% , diskon togel hingga 66% bisa bermain di android dan IOS kapanpun dan dimana pun. poker , bandarq , aduq, domino qq , dominobet. Semua permainan bisa dimainkan hanya dengan 1 ID. minimal deposit 10.000 ,- bonus turnover 0.5% dan bonus referral 20%. Bonus - bonus yang dihadirkan bisa terbilang cukup tinggi dan memuaskan, anda hanya perlu memasang pada situs yang memberikan bursa pasaran terbaik yaitu http://45.77.173.118/ Bola168. Situs penyedia segala jenis permainan poker online kini semakin banyak ditemukan di Internet, salah satunya TahunQQ merupakan situs Agen Judi Domino66 Dan BandarQ Terpercaya yang mampu memberikan banyak provit bagi bettornya. Permainan Yang Di Sediakan Dewi365 Juga sangat banyak Dan menarik dan Peluang untuk memenangkan Taruhan Judi online ini juga sangat mudah . Mainkan Segera Taruhan Sportbook anda bersama Agen Judi Bola Bersama Dewi365 Kemenangan Anda Berapa pun akan Terbayarkan. Tersedia 9 macam permainan seru yang bisa kamu mainkan hanya di dalam 1 ID saja. Permainan seru yang tersedia seperti Poker, Domino QQ Dan juga BandarQ Online. Semuanya tersedia lengkap hanya di ABGQQ. Situs ABGQQ sangat mudah dimenangkan, kamu juga akan mendapatkan mega bonus dan setiap pemain berhak mendapatkan cashback mingguan. ABGQQ juga telah diakui sebagai Bandar Domino Online yang menjamin sistem FAIR PLAY disetiap permainan yang bisa dimainkan dengan deposit minimal hanya Rp.25.000. DEWI365 adalah Bandar Judi Bola Terpercaya & resmi dan terpercaya di indonesia. Situs judi bola ini menyediakan fasilitas bagi anda untuk dapat bermain memainkan permainan judi bola. Didalam situs ini memiliki berbagai permainan taruhan bola terlengkap seperti Sbobet, yang membuat DEWI365 menjadi situs judi bola terbaik dan terpercaya di Indonesia. Tentunya sebagai situs yang bertugas sebagai Bandar Poker Online pastinya akan berusaha untuk menjaga semua informasi dan keamanan yang terdapat di POKERQQ13. Kotakqq adalah situs Judi Poker Online Terpercayayang menyediakan 9 jenis permainan sakong online, dominoqq, domino99, bandarq, bandar ceme, aduq, poker online, bandar poker, balak66, perang baccarat, dan capsa susun. Dengan minimal deposit withdraw 15.000 Anda sudah bisa memainkan semua permaina pkv games di situs kami. Jackpot besar,Win rate tinggi, Fair play, PKV Games