Howdy, Stranger!

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

Supported by

Problem with loop items in Python 2.7 (64 bit) package

Hi,

We are using opensesame_3.3.6-py27-win64-2. We are using py2.7 to follow these steps for communicating with Stimtracker via Serial port (link to the post). Once we have resolved that issue, we were trying to create an experiment, and now we have problems when adding a Loop item to our experiment.

A Syntax error occurs:

Error message:

Traceback (most recent call last):
  File "C:\Program Files (x86)\OpenSesame\Lib\site-packages\libqtopensesame\widgets\tree_overview.py", line 820, in dropEvent
    self.drop_event_item_new(data, e)
  File "C:\Program Files (x86)\OpenSesame\Lib\site-packages\libqtopensesame\widgets\tree_overview.py", line 719, in drop_event_item_new
    item, new_items = self.drop_get_item_snippet(data)
  File "C:\Program Files (x86)\OpenSesame\Lib\site-packages\libqtopensesame\widgets\tree_overview.py", line 605, in drop_get_item_snippet
    catch_exceptions=False)
  File "C:\Program Files (x86)\OpenSesame\Lib\site-packages\libqtopensesame\misc\qtitem_store.py", line 118, in new
    allow_rename=allow_rename
  File "C:\Program Files (x86)\OpenSesame\Lib\site-packages\libopensesame\item_store.py", line 211, in new
    fromlist=[u'dummy']
  File "C:\Program Files (x86)\OpenSesame\Lib\site-packages\libqtopensesame\items\loop.py", line 23, in <module>
    from libopensesame.loop import loop as loop_runtime
  File "C:\Program Files (x86)\OpenSesame\Lib\site-packages\libopensesame\loop.py", line 305
    ecol = col @ (
               ^
SyntaxError: invalid syntax

Line 305 and around in loop.py is as follows:

# Evaluate the weights before passing them to the weight
# function, so that weights can be defined in terms of
# variables.
ecol = col @ ( 
lambda w: self.syntax.auto_type(self.syntax.eval_text(w))
)
try:
dm = operations.weight(ecol)
except TypeError:
raise osexception(
u'weight values should be non-negative numeric values'
)

Moreover, there seems not to be a loop.pyc file associated to the loop file in 'C://../libopensesame' (see picture).


We honestly have no clue what is happening. So could you help us?

Thanks in advance,

Best wishes and "happy holidays"

Comments

  • Hi Pena,

    Would it be possible to connect to the Serial port with Python 3? You can look into PySerial3.4 (if you haven't already done so). Alternatively, I suppose you tried to drag & drop the loop item? Perhaps it will work when you go to experiment, and select there to add an item (the loop) to the experimental sequence.

    The error message itself is a of little help for the "regular user" (and also myself). My guess would be that there is a Python2/3 conflict somewhere. Maybe @sebastiaan has an idea what is going on.

    Eduard

    Buy Me A Coffee

  • Hi @pena and @eduard ,

    Thanks for pinging me in. The @ operator simply doesn't exist in Python 2, and it seems that I mistakenly used it anyway to fix a bug in OpenSesame 3.3.6. For now you can use OpenSesame 3.3.5, which should work. And this regression will be fixed in the next maintenance release (3.3.7). I filed an issue here.

    And if it's possible to use Python 3, that would be even better, of course!

    — Sebastiaan

  • Hi @eduard,

    I'm using py2.7 to follow these steps by @FlintMarco to communicate with Stimtracker via Serial port. I got the error missage "unicode strings are not supported, please encode to bytes" (or similar) when using the following instructions in an inline with Python 3 opensesame:

    exp.serial_port.write(chr(109) + chr(104) + chr(255) + chr(0))
    

    I tried to write the same encoding to bytes but I didn't get it. I imagine that there are many ways to solve the problem but I have not too much time and my experiment seems to work fine with Python 2, so for the moment, I will use older opensesame/Python versions.

    Thnak you very much!

  • Hi pena,

    Ok, good luck with your experiment!

    By the way, the error you describe seems to be affecting quite a few of users, but the good news is, there are also solutions: https://stackoverflow.com/questions/35642855/python3-pyserial-typeerror-unicode-strings-are-not-supported-please-encode-to

    Eduard

    Buy Me A Coffee

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