Jump to content


Photo

python help moving code from mac to windows wont work now


  • Please log in to reply
2 replies to this topic

#1 mindfad

mindfad

    Young Padawan

  • Members
  • Pip
  • 2 posts

Posted 06 June 2009 - 12:33 PM

from psychopy import visual, core, misc, eventimport numpy #for maths on arraysfrom numpy.random import random, shuffle #we only need these two commands from this libfrom random import *import mathwin = visual.Window([1024,768], units='pix', monitor='testMonitor',rgb=(-1,-1,-1))numbers = range(100) #range of stimuli to be generated or how many to generate#Choose N, elementsize and filenamesfor x in numbers:N=85 #number to generate0#To choose which stimuli to generate uncomment the appropriate line#Contour length#elemSize = 2000/((N)*math.pi*2)#contour lentgth#elemSize = 2000/((50)*math.pi*2)#50CLcontrol#Brightness controls# elemSize=math.sqrt(70000/((N)*math.pi))#...elemSize=math.sqrt(70000/((50)*math.pi...#create empty list of locationslocations=[]i=1while i<=N :locations.append([randrange(int(elemSi...i=i+1#build an array of circles according to the parametersglobForm = visual.ElementArrayStim(win, nElements=N, units='pix',sizes=elemSize,fieldShape='s...globForm.draw()win.flip(clearBuffer=False)#redraw the bufferwin.getMovieFrame()win.flip(clearBuffer=True)#adjustfilename as appropriatewin.saveMovieFrames('B085.jpg')core.quit()event.clearEvents()#keep the event buffer from overflowing





The error message im getting,

Running C:\Documents and Settings\Administrator\Desktop\NumberStu...
configured pyglet screen 0
Exception in thread Thread-3:
Traceback (most recent call last):
File "threading.pyc", line 460, in __bootstrap
File "PsychoPyIDE.py", line 181, in __run
File "threading.pyc", line 440, in run
File "PsychoPyIDE.py", line 1687, in _runFileAsImport
File "<string>", line 1, in <module>
File "C:\Documents and Settings\Administrator\Desktop\NumberStu... line 36, in <module>
File "psychopy\visual.pyc", line 2519, in draw
AttributeError: Window instance has no attribute '_progSignedTexMask'

To provide as much information as possible im using a script editor i think that what they would be called i know almost nothing about programming, called PsychoPy IDe which can be found here. Ive downloaded the windows versions of the psychopy ide and all the dependiences for python and python and im still gettting the same error message. Can anyone tell what is wrong with the code or possible a place that could "debug" it and tell me which line is causing the problem my professor wrote the code but knows only enough to write it and could possible fix it if someone could tell mewhat line is causing the error.

#2 mindfad

mindfad

    Young Padawan

  • Members
  • Pip
  • 2 posts

Posted 06 June 2009 - 02:15 PM

code was corrupted by how i copied and pasted
from psychopy import visual, core, misc, event

import numpy #for maths on arrays

from numpy.random import random, shuffle #we only need these two commands from this lib

from random import *

import math



win = visual.Window([1024,768], units='pix', monitor='testMonitor',rgb=(-1,-1,-1))



numbers = range(100) #range of stimuli to be generated or how many to generate



#Choose N, elementsize and filenames



for x in numbers:



	N=85 #number to generate0

	#To choose which stimuli to generate uncomment the appropriate line

	#Contour length

	#elemSize = 2000/((N)*math.pi*2)#contour lentgth

	 #elemSize = 2000/((50)*math.pi*2)#50CLcontrol



	#Brightness controls

   # elemSize=math.sqrt(70000/((N)*math.pi))#brightness

	elemSize=math.sqrt(70000/((50)*math.pi))#50BRcontrol



	#create empty list of locations

	locations=[]



	i=1

	while i<=N :

		locations.append([randrange(int(elemSize)-512,512-int(elemSize)),randrange(int(elemSize)-389,389-int(elemSize))])

		i=i+1

				

	 #build an array of circles according to the parameters

	globForm = visual.ElementArrayStim(win, nElements=N, units='pix',sizes=elemSize,fieldShape='sqr',fieldSize=(1024-elemSize,768-elemSize),sfs=0,elementMask='circle',xys=locations)

	

	globForm.draw()

	win.flip(clearBuffer=False)#redraw the buffer

	win.getMovieFrame()

	win.flip(clearBuffer=True)



#adjustfilename as appropriate

win.saveMovieFrames('B085.jpg')

core.quit()

event.clearEvents()#keep the event buffer from overflowing


#3 rc69

rc69

    PHP Master PD

  • P2L Staff
  • PipPipPipPip
  • 3,827 posts
  • Gender:Male
  • Location:Here
  • Interests:Web Development

Posted 07 June 2009 - 10:25 PM

I've never worked with python, so i can't say for sure, but looking at the errors you have there, this is the most logical one to start at:

File "C:\Documents and Settings\Administrator\Desktop\NumberStu... line 36, in <module>

a. It reads as though it is from the file you pasted here.
b. The code you pasted has a line 36, which looks like a call to something which could cause problems (i hate drawing, and it's followed by an error saying something is going wrong in draw...)

Gl :censored:

Edited by rc69, 07 June 2009 - 10:28 PM.





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users