Can't send trigger during first 500ms of a 2750ms trial

I’ve decided to take your advice and get out of the builder. I modified my EEG configuration file to accept different trigger values as my TURN-ON and TURN-OFF save function. This seems to work fine. However, my triggers during a trial are still very, very random. Sometimes, the first number doesn’t appear, and rarely I see the correct decimal showing on my EEG software. Here’s a simplified code I’m working with.

    from psychopy import visual, core, data, parallel
    import block2dict #house written module for trial randomization, and block balancing 

    mywin = visual.Window(size=(1280, 1024), fullscr=True, screen=1, allowGUI=False,               allowStencil=False,
    monitor=u'SyncMaster', color=[-1,-1,-1], colorSpace='rgb',
    blendMode='avg', useFBO=True,
    )

    block1 = block2dict.block2dict("block1.csv") 

    #Block One
    thisTrial=0 #index to stop the test blocks.
    mysize=1 #size of the stimulus 

    #p_port=parallel.PParallelInpOut32() #tried this with no effect
    p_port=parallel.ParallelPort() #set up a class
    p_port.setData(0) #clear out the pport

    framerate = 60 

    #main loop for testing the trigger and the synchronization
    for n in range(10):
    stimulus_1 = visual.ImageStim(win=mywin,image= block1['image_one'][n], pos=[0,0], size=[mysize ,mysize])
    stimulus_2 = visual.ImageStim(win=mywin,image = block1['image_two'][n], pos=[0,0],size=[mysize ,mysize])
    stimulus_3 = visual.ImageStim(win=mywin,image = block1['image_three'][n], pos=[0,0],size=[mysize ,mysize])
    stimulus_4 = visual.ImageStim(win=mywin,image = block1['image_four'][n], pos=[0,0],size=    [mysize ,mysize])
    trig1=block1['trig1'][n] #corresponds to a unique code for the stimulus 
    trig2=block1['trig2'][n]
    trig3=block1['trig3'][n]
    trig4=block1['trig4'][n]
    
    #first level
    stimulus_1.setAutoDraw(True)
    mywin.callOnFlip(p_port.setData, int(trig1)) #need to convert the string to an integer
    for frame in range(framerate*1):
        mywin.flip()
    mywin.callOnFlip(p_port.setData, 0)
    stimulus_1.setAutoDraw(False)
    
    #second level
    stimulus_2.setAutoDraw(True)
    mywin.callOnFlip(p_port.setData, int(trig2))
    for frame in range(framerate*1):
        mywin.flip()
    mywin.callOnFlip(p_port.setData, 0)
    stimulus_2.setAutoDraw(False)
    
    #third level 
    stimulus_3.setAutoDraw(True)
    mywin.callOnFlip(p_port.setData, int(trig3))
    for frame in range(framerate*1):
        mywin.flip()
    mywin.callOnFlip(p_port.setData, 0)
    stimulus_3.setAutoDraw(False)
    
    #fourth level
    stimulus_4.setAutoDraw(True)
    mywin.callOnFlip(p_port.setData, int(trig4))
    for frame in range(framerate*1):
        mywin.flip()
    mywin.callOnFlip(p_port.setData, 0)
    stimulus_4.setAutoDraw(False)
    
    thisTrial = thisTrial+1
	
    mywin.close() 

I will update with a link to a video of the trigger output on the acquisition software when I get to the lab later today. Best Wishes from Berlin everyone!

Dan