- This topic has 4 replies, 1 voice, and was last updated 5 years, 11 months ago by
Thao Tran.
-
AuthorPosts
-
March 19, 2019 at 11:35 am #2803
camilo
Guesthi,
I am trying to run an instance of IBEX locally to use in a computer in the lab with no internet access. It works fine for regular ibex experiments, but since the penncontroller requires access to an online server to load images and audio (when calling “PennController.AddHost”) I am not sure how to get it to do this locally. How can i get it to check a local folder on the computer instead of an online server?
thanks a lot for the help (and for penncontroller in general, its awesome 🙂 )March 19, 2019 at 8:01 pm #2804Jeremy
KeymasterHi Camilo,
Are you running you IBEX instance on Mac OS? If so, you can place your image and audio files in
/Library/WebServer/Documents/
(or~/Sites/
) and then access it at, e.g.http://localhost/myImage.png
. So this should work:PennController.AddHost("http://localhost/"); PennController( newImage("my image", "myImage.png") .print() , newButton("continue", "Continue") .print() .wait() )
Alternatively you can edit the file
server.py
in your experiment’swww
folder and, below these two lines:if fname.endswith(".wav") or fname.endswith(".mp3") or fname.endswith("m4a"): continue
add
if fname.endswith(".png") or fname.endswith(".jpg") or fname.endswith(".bmp"): continue
And further down, replace this line:
start_response('200 OK', [('Content-Type', 'audio/mpeg'), ('Content-Length', stats.st_size)])
withif qs_hash['resource'][0].endswith(".wav") or qs_hash['resource'][0].endswith(".mp3") or qs_hash['resource'][0].endswith(".m4a"): start_response('200 OK', [('Content-Type', 'audio/mpeg'), ('Content-Length', stats.st_size)]) elif qs_hash['resource'][0].endswith(".png") or qs_hash['resource'][0].endswith(".jpg") or qs_hash['resource'][0].endswith(".bmp"): start_response('200 OK', [('Content-Type', 'image/*'), ('Content-Length', stats.st_size)])
Then you can place your image and audio files (though no OGG file) in chunk_includes and do this:
PennController( newImage("my image", "http://localhost:3000/server.py?resource=myImage.png") .print() , newButton("continue", "Continue") .print() .wait() )
March 26, 2019 at 3:50 pm #2822camilo
GuestHi Jeremy,
wow, thanks so much for the detailed response! Unfortunately neither of these solutions worked for me. The first one (for mac) keeps spitting out this error in the terminal running the server.py:
127.0.0.1 - - [26/Mar/2019 16:35:10] "GET /picture.jpg HTTP/1.1" 404 -
I don’t know what it means, but it seems to not be able to connect to the local server (I saved all the pictures to /Library/WebServer/Documents/)
The experiment runs fine otherwise and goes through all items, it just doesnt show any of the pictures.
The second solution, working on a windows, seems to be even trickier, since the experiment doesn’t run at all, it gets stuck trying to load the images. the output of server.py shows a lot of stuff that I (again) have no idea what it means:
127.0.0.1 - - [26/Mar/2019 15:32:02] "GET /experiment.html HTTP/1.1" 200 - 127.0.0.1 - - [26/Mar/2019 15:32:02] "GET /jquery.min.js HTTP/1.1" 200 - 127.0.0.1 - - [26/Mar/2019 15:32:02] "GET /jquery-ui.min.js HTTP/1.1" 200 - 127.0.0.1 - - [26/Mar/2019 15:32:02] "GET /jsDump.js HTTP/1.1" 200 - 127.0.0.1 - - [26/Mar/2019 15:32:02] "GET /PluginDetect.js HTTP/1.1" 200 - 127.0.0.1 - - [26/Mar/2019 15:32:02] "GET /server.py?include=serverinfo_js HTTP/1.1" 200 - 127.0.0.1 - - [26/Mar/2019 15:32:02] "GET /shuffle.js HTTP/1.1" 200 - 127.0.0.1 - - [26/Mar/2019 15:32:02] "GET /json.js HTTP/1.1" 200 - 127.0.0.1 - - [26/Mar/2019 15:32:02] "GET /soundmanager2-jsmin.js HTTP/1.1" 200 - 127.0.0.1 - - [26/Mar/2019 15:32:02] "GET /backcompatcruft.js HTTP/1.1" 200 - 127.0.0.1 - - [26/Mar/2019 15:32:02] "GET /server.py?include=data HTTP/1.1" 200 - 127.0.0.1 - - [26/Mar/2019 15:32:02] "GET /conf.js HTTP/1.1" 200 - 127.0.0.1 - - [26/Mar/2019 15:32:02] "GET /server.py?include=js HTTP/1.1" 200 - ../css_includes127.0.0.1 - - [26/Mar/2019 15:32:03] "GET /server.py?include=main.js HTTP/1.1" 200 - 127.0.0.1 - - [26/Mar/2019 15:32:03] "GET /server.py?include=css HTTP/1.1" 200 - 127.0.0.1 - - [26/Mar/2019 15:32:03] "GET /util.js HTTP/1.1" 200 - -------------------------------------------------------------------------------- Exception happened during processing of request fromException happened during processing of request from ( ----------------------------------------'1 27.0.0.(1'Exception happened during processing of request from', 127.0.0.1'50483(', 12----------------------------------------7.0.0.1' ), 50484Exception happened during processing of request from 50485T)raceback (most recent call last): ) File "C:\Python27\lib\SocketServer.py", line 599, in process_request_thread (Traceback (most recent call last): 'T1raceback (most recent call last): 2 7 File "C:\Python27\lib\SocketServer.py", line 599, in process_request_thread . 0 File "C:\Python27\lib\SocketServer.py", line 599, in process_request_thread . 0 self.finish_request(request, client_address) . 1 self.finish_request(request, client_address) ' , self.finish_request(request, client_address) 50486 ) File "C:\Python27\lib\SocketServer.py", line 334, in finish_request File "C:\Python27\lib\SocketServer.py", line 334, in finish_request File "C:\Python27\lib\SocketServer.py", line 334, in finish_request self.RequestHandlerClass(request, client_address, self) self.RequestHandlerClass(request, client_address, self) Traceback (most recent call last): File "D:\ADMIN_Experiments\Ibex\ibex-master\www\server.py", line 1775, in __init__ - File "C:\Python27\lib\SocketServer.py", line 599, in process_request_thread --------------------------------------- File "D:\ADMIN_Experiments\Ibex\ibex-master\www\server.py", line 1775, in __init__ E xception happened during processing of request from SimpleHTTPServer.SimpleHTTPRequestHandler.__init__(self, request, client_address, server) ( self.finish_request(request, client_address) '1 2 File "C:\Python27\lib\SocketServer.py", line 334, in finish_request 7 . self.RequestHandlerClass(request, client_address, self) 0 . File "C:\Python27\lib\SocketServer.py", line 655, in __init__ 0 . SimpleHTTPServer.SimpleHTTPRequestHandler.__init__(self, request, client_address, server) 1 ' self.handle() - ---------------------------------------, File "C:\Python27\lib\SocketServer.py", line 655, in __init__ 50487 File "D:\ADMIN_Experiments\Ibex\ibex-master\www\server.py", line 1775, in __init__ E xception happened during processing of request from File "C:\Python27\lib\BaseHTTPServer.py", line 340, in handle () self.RequestHandlerClass(request, client_address, self) ' 1 self.handle() 2 SimpleHTTPServer.SimpleHTTPRequestHandler.__init__(self, request, client_address, server) 7 . self.handle_one_request() 0 . File "D:\ADMIN_Experiments\Ibex\ibex-master\www\server.py", line 1775, in __init__ 0 . File "C:\Python27\lib\BaseHTTPServer.py", line 340, in handle 1T'raceback (most recent call last): , 50488 self.handle_one_request() ) File "C:\Python27\lib\SocketServer.py", line 599, in process_request_thread Traceback (most recent call last): self.finish_request(request, client_address) File "C:\Python27\lib\SocketServer.py", line 334, in finish_request File "C:\Python27\lib\BaseHTTPServer.py", line 328, in handle_one_request self.RequestHandlerClass(request, client_address, self) File "C:\Python27\lib\SocketServer.py", line 599, in process_request_thread SimpleHTTPServer.SimpleHTTPRequestHandler.__init__(self, request, client_address, server) self.finish_request(request, client_address) File "C:\Python27\lib\BaseHTTPServer.py", line 328, in handle_one_request method() File "D:\ADMIN_Experiments\Ibex\ibex-master\www\server.py", line 1775, in __init__ File "C:\Python27\lib\SocketServer.py", line 655, in __init__ File "C:\Python27\lib\SocketServer.py", line 655, in __init__ File "C:\Python27\lib\SocketServer.py", line 334, in finish_request method() File "D:\ADMIN_Experiments\Ibex\ibex-master\www\server.py", line 1829, in do_GET SimpleHTTPServer.SimpleHTTPRequestHandler.__init__(self, request, client_address, server) File "C:\Python27\lib\SocketServer.py", line 655, in __init__ self.handle() self.RequestHandlerClass(request, client_address, self) File "D:\ADMIN_Experiments\Ibex\ibex-master\www\server.py", line 1829, in do_GET self.do_either('GET') File "D:\ADMIN_Experiments\Ibex\ibex-master\www\server.py", line 1813, in do_either self.handle() File "C:\Python27\lib\BaseHTTPServer.py", line 340, in handle File "D:\ADMIN_Experiments\Ibex\ibex-master\www\server.py", line 1775, in __init__ self.do_either('GET') SimpleHTTPServer.SimpleHTTPRequestHandler.__init__(self, request, client_address, server) assert response_type[0] File "C:\Python27\lib\BaseHTTPServer.py", line 340, in handle self.handle_one_request() File "D:\ADMIN_Experiments\Ibex\ibex-master\www\server.py", line 1813, in do_either self.handle() File "C:\Python27\lib\SocketServer.py", line 655, in __init__ AssertionError ---------------------------------------- self.handle_one_request() File "C:\Python27\lib\BaseHTTPServer.py", line 328, in handle_one_request assert response_type[0] method() self.handle() File "C:\Python27\lib\BaseHTTPServer.py", line 328, in handle_one_request File "C:\Python27\lib\BaseHTTPServer.py", line 340, in handle - method()
(This is just the first part of the output)
I really have no idea how to make this work, any help would be immensly appreciated!
March 26, 2019 at 5:29 pm #2824Jeremy
KeymasterHi Camilo,
1. Have you tried placing your images in
~/Sites/
as well?2. The errors could be due to hidden files in chunk_includes. On Mac, Finder automatically generates .DS_Store in some folders, which usually causes Ibex to crash. I usually solve the problem in the Terminal, I move to the chunk_includes folder and I type
rm .DS_Store
.This is an archive of the experiment I successfully ran on my Mac, if you want to try it yourself (and/or copy the
server.py
file in case you have doubts on the edits I describe in my previous message):
https://www.dropbox.com/s/x62tvt20e775i8m/ibex-local.zip?dl=0-
This reply was modified 5 years, 11 months ago by
Jeremy.
March 26, 2019 at 10:57 pm #2826Thao Tran
GuestBasically what is needed is are a webserver, that serves static files (jpg, mp3, etc), to be installed locally on your machine. There are many way to do that. Using Python httpserver is a portable and quick way, which is possible on any OS with python installed. For windows there is an instruction here: https://stackoverflow.com/a/5128451. See also other answers.
That approach may seem dirty (but it should work!). More elegantly, Ibex server seems to use SimpleHttpserver already, so it is possible to configure it to serves static files from a folder in ibex folder structure (e.g., using relative path). This however requires some programming skill.
-
This reply was modified 5 years, 11 months ago by
-
AuthorPosts
- You must be logged in to reply to this topic.