Howdy, Stranger!

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

Supported by

[solved] Importing matplotlib within a) an inline script and/or b) the Pyhton code for a plugin

edited January 2014 in OpenSesame

Hi all,

To be able to draw circles that are additions and substractions to eachother (see below or here - btw: I didn't add 'vd' to the url, imageshack did...), I can't simply use the canvas 'circle'-function, but I use Pyhton code instead (for which I translated of one of my Matlab-functions, but it works fine in PythonWin). This code makes a 2D-array and draws it so the screen by using the matplotlib 'show' and 'matshow' commands. When I try importing matplotlib (simply by using 'import matplotlib as mpl'), however, the folowing error occurs:

Error: Inline script error

In: inline_script (run phase)
File "matplotlib__init__.pyo", line 495, in _get_data_path

Python traceback:
AttributeError: 'module' object has no attribute 'afm'

And the following in the debugwindow:

Traceback (most recent call last):
File "libopensesame\inline_script.pyo", line 112, in run
File "", line 2, in
File "matplotlib__init__.pyo", line 765, in
File "matplotlib__init__.pyo", line 683, in rc_params
File "matplotlib__init__.pyo", line 599, in matplotlib_fname
File "matplotlib__init__.pyo", line 246, in wrapper
File "matplotlib__init__.pyo", line 520, in _get_data_path_cached
File "matplotlib__init__.pyo", line 495, in _get_data_path
AttributeError: 'module' object has no attribute 'afm'

I've checked the library, but 'afm.pyo' really is in there. Curiously, importing numpy in the same fashion ('import numpy as np') works perfectly well,

What am I doing wrong and is there another way to put 2D-arrays on the screen?

Many thanks in advance!
Edwin

Image 1 - an image as created by my function: 20 circles with a random size (between 50 and 250 px) and a random colour, added and substracted from eachother (colormap is gray, with vmin=-130 and vmax=130)

image

Comments

  • edited 8:24PM

    Hi Edwin,

    I checked it, and it appears that some parts of matplotlib are missing from the OpenSesame windows packages. It is not uncommon (but very annoying) for some dependencies to go missing (or break) when creating packages with py2exe. There's not much that can be done about it without repackaging it. Incidentally, matplotlib does appear to work with your own Portable OpenSesame!

    There are lots of ways to perform these types of drawing operations. Using NumPy in combination with PyGame surfarrays, using PIL (Python imaging), using matplotlib (I suppose, haven't tried it), and using PsychoPy. I would personally tend to go for PsychoPy, because it's faster, but it's mostly down to personal preference.

    Good luck!

    Cheers,
    Sebastiaan

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