Golem Task respons back with runtime error 2, can't determine the cause - python-3.x

Repo for all code I've been using is updated here . When I run the requestor script it exits with a runtime error 2 (File not found). I am not sure how to further debug this or fix it. So far I've converted my code over to a python slim docker image to better mirror the example. It also works for me when I spin up a docker image that typing and running "/golem/work/imageclassifier.py --trainmodel" works from root. I switched all my code to use absolute paths. I also did make sure the shebang (#!) uses linux end of file characters rather than windows before which was giving me errors. Fixed a bug where my script returns error code 2 when called with no args to now pass.
clf.fit(trainDataGlobal, trainLabelsGlobal)
pkl_file = "classifier.pkl"
with open(pkl_file, 'wb') as file:
pickle.dump(clf, file)
is the only piece I could think of that causes the issue, but as far as I can tell this is the proper way to pickle something in python. Requestor script is also heavily based on the simple service example and I tried to mirror my design to that. I just need help in getting more information while debugging, or guidance on how to move forward from here

Related

create exception when python command generates a program.exe has stopped working type error

I am facing a problem with a program i am developing in Python 3.6 under Windows 10.
One particular command generates an unknown error, windows throws a 'program.exe has stopped working' message and the program exits.
The command is a 3d-model loader that is part of another python package (Panda3D). The crash is always associated with this command (and more particularly with a specific dll of the loader) and a particular file that it tries to open.
Since i cannot locate and therefore solve the faults in the dll (probably there is a bug there) i would like to just pass the problematic file and continue to the next one. But since python exits and i do not know the error type, the typical try, except does not work.
So, i would like to know if there is a way to predict this type of behavior in my code and prevent the program from exiting.
Many thanks for any help.
The pop-up "Program.exe has stopped working." can be caused by a variety of things and therefor there is no "one size fits all" type solution. But if you're certain that your problem is cause by a specific line of code you can always try something along the lines of :
try:
loader.loadModel("c/path/to/your/file")
except Exception as e:
print(e.message, e.args)
# your error-handling code here
Make sure the file path that you're giving to loadModel respects the following :
# WRONG:
loader.loadModel("c:\\Program Files\\My Game\\Models\\Model1.egg")
# RIGHT:
loader.loadModel("/c/Program Files/My Game/Models/Model1.egg")
Source : pandas3d official documentation

Trying to launch my node.js program with npm but nothing happens

I am trying to make this slack bot run : https://github.com/lmammino/norrisbot
I am not very skilled with npm and node yet, but I follow his instructions and try to run the bot with the help of the npm start command.
Here's the output I get :
F:\norrisbot>npm start
> norrisbot#1.0.5 start F:\norrisbot
> node bin/bot.js
F:\norrisbot>
No error, but nothing happens either in the console or the slack general channel...
By the way I set up my BOT_API_KEY variable correctly (with the token.js method)
By your command prompt it's clear you're running in Windows. The operations for running Node properly in Windows are different in several ways from Mac/Linux, and a LOT (most?) of developers don't address these because they're on Mac/Linux themselves. Path formats, file locations, how you expose environment variables, and all sorts of things are different in Win.
Try hand-editing bin/bot.js in your locally cloned copy of the repo. Find this line at the end of the file:
norrisbot.run();
Change it to read as follows:
console.log('Running Norris Bot');
norrisbot.run();
console.log('Ran Norris Bot');
I bet you will find that either NEITHER of these lines gets printed, or only one does.
If NEITHER line gets printed, the issue is with the npm command improperly formatting the path to the executable script for Windows users. In that case, try running it as (make sure NodeJS is in your PATH):
node bin/bot.js
If only the FIRST line gets printed, there is almost certainly a bug elsewhere in the module itself. I didn't evaluate all of its code, and I'm not on Windows myself at the moment - I just use it often enough to be aware of its differences. But either way it will get you started on finding the issue, and if it's truly a bug, you can pursue the bug report I see you've already filed in Github.

mcc -mv in linux machine R2013a

When I am trying to make executable files of my .m-files on a Linux machine, some of the the .m-files are working absolutely fine.
However, one file which has camera input inside the .m-file is giving me this error:
Depfun error: 'Unexpected Standard exception from MEX file. What() is: ..' Error using mcc Error executing mcc, return status = 1 (0x1).
But when I use the same .m-file on Windows and R2012a it is working properly without any error.
I found a bug report here - is this a similar problem?
How do I solve it?
Here is the simple code of my .m-file:
function yuv()
vid1 = videoinput('linuxvideo', 1, 'YUYV_1280x960');
set(vid1,'FramesPerTrigger',1);
start(vid1);
imageData1=getdata(vid1,1);
imageData=ycbcr2rgb(imageData1);
imagesc(imageData(:,:,:,1));
end
I was getting the same Depfun error, "What() is: ..", under R2013a on Linux but no errors when using a different OS or an older MATLAB version to compile my code. Following the bug report you linked to fixed it for me.
In the zip file linked to in the bug report you'll find a depfun.opts file. Rename or move your original depfun.opts file that's located in [matlabroot]/toolbox/compiler and copy the new one in its place.
Putting the new depfun.opts file in place is all it took for me to be able to compile using R2013a on Linux.
Also note, the bug report says that it could be caused by the importdata function or the Parallel Computing Toolbox but I'm not using either of those.

Issues running FSL command in Linux environment

I am new to FSL, using version 4.1.8. I am trying to run a script that reads and generates *.nii files, which format is normally supported by FSL. I am calling an FSL function, probtrackx from within Matlab. However, I get the following error message seemingly unable to generate or recognize *.nii files:
** ERROR (nifti_image_read): failed to find header file for '~/Documents/fMRI_data/../DTI/fsl_dti/masks/target_mask_001'
** ERROR: nifti_image_open(~/Documents/fMRI_data/../DTI/fsl_dti/masks/target_mask_001): bad header info
ERROR: failed to open file ~/Documents/fMRI_data/../DTI/fsl_dti/masks/target_mask_001
ERROR: Could not open image ~/Documents/fMRI_data/../DTI/fsl_dti/masks/target_mask_001
The files do exist but FSL fails to recognize them. Any help as to how to correct the issue and get FSL to work properly would be most appreciated. I suspect it's a Linux settings issue, just not sure how to fix it. A solution to a related problem in a previous posting suggested adding ls='ls --color=auto'. I've tried it to on avail.
Some FSL tools assume that the $FSLDIR unix unvironment variable is set, which might not be the case in your MATLAB environment. You can fix that with something like setenv('FSLDIR', '/usr/local/fsl') (modified of course if your FSL installation is in a different place). Some also need the regular FSL setup script to be executed as well: system('. ${FSLDIR}/etc/fslconf/fsl.sh'). See also: http://www.fmrib.ox.ac.uk/fsl/fsl/downloading.html.
Instead of the more complicated probtrackx script, another thing to try first is simply:
system('fslhd ~/Documents/fMRI_data/../DTI/fsl_dti/masks/target_mask_001')
If this fails with the same error, then you know that you entered the path to the data incorrectly. For example, do you mean to have the .. in there?
Also, in the future, the best place to get FSL support is on their mailing list at: https://www.jiscmail.ac.uk/cgi-bin/webadmin?A0=fsl
Does MATLAB have access to run other fsl commands? If you are able to run a command from the command line but not through MATLAB, the MATLAB user may not have access to run fsl or may be looking for some FSL variables.
You might have to do the equivalent of this for a linux system

Capturing code generated by Qemu in a file

In qemu, when we are giving instructions it gets converted to the machine code for the particular architecture. I would like to write this code to a file. For that I think in cpu-exec.c the generated code is obtained (it is returned for execution). How will i copy it to a file?
/qemu-0.14.0/cpu-exec.c
find cpu_gen_code() # translate-all.c:57,
-to->
# line104: log_disas(tb->tc_ptr, *gen_code_size_ptr);
try to hack it.

Resources