GrADS script sometimes throws error while opening grib ctl file - grads

Getting this error for GrADS (SUN Grid Engine) logic. However, the grib file and its associated ctl file exist and are valid. If I try to re-run the grads script job, it succeeds. I just don't understand why it sometimes fails.
opening ctl file
/data/myprogram/20211027/gribs/mygribname.grb.ctl
Open Error: Can't open binary data file
File name = /data/myprogram/20211027/gribs/mygribname.grb
The funny thing is... the code is trying to open the ctl file and not the gribfile. Not sure why it even tried to open the gribfile instead.

I figured out the answer to my question. I had to study a little bit of GrADS so I could interpret the logs better. The error above is thrown when the file does not exist. In my case, the file was there. However, it was getting generated after it was accessed by the GrADS code. And sometimes, the file was getting written as GrADS code was trying to access it. I added timestamps to the operations with full iso mode. The operations were happening within milliseconds of each other.

Related

I am trying to perform a simple linear regression on a csv data set, but R won't read the dataset

I am running the code below to use a CSV file so that I can perform a linear regression. A few fixes I found here and on other sites included the "setwd" command and closing the CSV file before running the command. I am still generating the error.
setwd("C:/Users/Tommy/Desktop/")
dataset = file.choose("Project_subset.csv")
dataset = read.csv("dataset")`
> dataset = read.csv("dataset")
Error in file(file, "rt") : cannot open the connection
In addition: Warning message:
In file(file, "rt") : cannot open file 'dataset': No such file or directory
I appreciate the help on a simple problem.
I entered several different codes to read the csv file and none have been successful. I keep getting the error above that the file does not exist. I also used the file.exist() code and it returned FALSE. I am very confused as this seems to be a simple command to use.

exception handling in executable

I'm actually writing a programm to analyze excel data and creating an output file with the analyzed data. For reading the input files I use pandas wrapping a try/except block around to catch IOErrors if any of the input files is opened in the background, otherwise the program crashes. My program has to be converted to an exe. that other people can use it.
Now coming to the problem, if I start the program from the PyCharm IDE the exception handling works fine. But if I start the program as an exe. it always throws the exception even if the input files are closed.
Below my code, just a normal exception handling.
try:
dataset = pd.read_excel(path_cmd_data, engine='openpyxl')
pattern = pd.read_excel(path_cmd_regex, sheet_name='RegexTCM', engine='openpyxl')
production_dates = pd.read_excel(path_cmd_prod_dates, engine='openpyxl')
except IOError:
self.label3.setText('Reading Input Data failed!')
return
Thanks for your help, I'm a bit lost with this problem.

PsychoPy - Workaround for (still ongoing) pyglet memory leak affecting text components displayed at frame-level

I too have run across the infamous pyglet memory leak, that occurs when one needs to update text components at the frame level (with a text variable typically computed in a separate code component, also at frame level).
The leak/bug crashes a running script with an error message of the sort:
File "C:\Program Files (x86)\PsychoPy2\lib\site-packages\psychopy-1.83.04-py2.7.egg\psychopy\visual\window.py", line 541, in flip
thisStim.draw()
File "C:\Program Files (x86)\PsychoPy2\lib\site-packages\psychopy-1.83.04-py2.7.egg\psychopy\visual\text.py", line 603, in draw
self._pygletTextObj.draw()
File "C:\Program Files (x86)\PsychoPy2\lib\site-packages\pyglet\font\__init__.py", line 565, in draw
self._layout.draw()
File "C:\Program Files (x86)\PsychoPy2\lib\site-packages\pyglet\text\layout.py", line 852, in draw
self.batch.draw()
File "C:\Program Files (x86)\PsychoPy2\lib\site-packages\pyglet\graphics\__init__.py", line 544, in draw
func()
File "C:\Program Files (x86)\PsychoPy2\lib\site-packages\pyglet\graphics\__init__.py", line 476, in <lambda>
(lambda d, m: lambda: d.draw(m))(domain, mode))
File "C:\Program Files (x86)\PsychoPy2\lib\site-packages\pyglet\graphics\vertexdomain.py", line 313, in draw
glDrawArrays(mode, starts[0], sizes[0])
WindowsError: exception: access violation reading 0x00000010
Exception TypeError: "'NoneType' object is not callable" in <bound method Server.__del__ of <pyolib.server.Server object at 0x0EFB3670>> ignored
I know the PsychoPy community has linked this to a memory leak in pyglet that was meant to have been fixed around April 2016 according to this thread. I downloaded the latest version of Pyglet (which is v1.2.4 - released apparently in Sep 2015, so before the supposed fix of the leak) and replaced its contents under c:\Program Files (x86)\PsychoPy2\Lib\site-packages\pyglet\. However, this did not fix my problem.
Unfortunately, my experiment does not make sense if I give up the frame-wise computation that feeds the text component.
An older thread that I found suggested the following workaround: in the code component that computes frame-wise the value of the text variable being displayed, only assign this variable a new value if that new value actually differs from the previous value. However, even after changing my code component this way, the pyglet error still pops up.
Assuming the bug was fixed in Pyglet, is it not v1.2.4 that reflects this fix, and should it not be updated by overwriting the contents of c:\Program Files (x86)\PsychoPy2\Lib\site-packages\pyglet\ (maintaining the original folder structure)?
Assuming the bug was in fact NOT fixed in Pyglet, can anyone suggested a different workaround that I can try to make my PsychoPy expt not crash?
Many thanks indeed for your help.
(Apologies for the double post both here and on the psychopy group; will update both threads as soon as there is a response on the other, to avoid people wasting time with double answers).
One workaround is to use TextBox instead of TextStim. To do that, one first defines a stimulus object in a code component (under "begin routine"), such as
textbox = visual.TextBox(window=win,
text='Something',
font_size=21,
font_color=[-1,-1,1],
size=(1.9, .3),
pos=(0.0, 0.25),
grid_horz_justification='center',
units='norm')
then, perhaps under the "every frame" tab, one uses code to customise & call upon the thus-defined textbox, with syntax as found on http://www.psychopy.org/api/visual/textbox.html

DATASET_CANT_CLOSE error number 32 "Broken Pipe"

I experienced an error in SAP ABAP which says DATASET_CANT_CLOSE with error number 32 (Broken Pipe). Question is: what procedure triggered this kind of error?
As far as I know, this error was triggered by:
CLOSE DATASET dset
But I can't reproduce the error since I don't know what procedure does trigger this kind of error.
This is the code I use:
method GENERATE_TXT_FILE.
DATA :
lwa_data TYPE t_line,
lv_param TYPE sxpgcolist-parameters.
"Upload File to Server
*Open Dataset
OPEN DATASET im_file_name FILTER 'dos2ux'
FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.
CLEAR lwa_data.
LOOP AT it_data INTO lwa_data.
CATCH SYSTEM-EXCEPTIONS file_access_errors = 4
OTHERS = 8.
TRANSFER lwa_data-lines TO im_file_name.
ENDCATCH.
IF sy-subrc <> 0.
CLEAR lwa_data.
EXIT.
ENDIF.
CLEAR lwa_data.
ENDLOOP.
*Close Dataset
CLOSE DATASET im_file_name.
As I have investigated through the background job log, it seems that the current server which run the background job haven't got mapped yet to the text file folder. Solution is to re-map the server to text file folder.
You are using the FILTER extension to OPEN DATASET - which can be a HUGE security issue as well as raise loads of portability issues unless you know what you're doing, but that's not what the question is about. From the documentation:
When the statement OPEN DATASET is executed, a process is started in
the operating system for the specified statement. When the file is
opened for reading, a channel (pipe) is linked with STDOUT of the
process, from which the data is read during file reading. The file
itself is linked with STDIN of the process. When the file is opened
for writing, a channel (pipe) is linked to STDIN of the process, to
which data is passed when writing. The output of the process is
diverted to this file.
In your case, the filter command probably decided to bail out - see this answer among many. Why is hard to investigate - you may have to go through various system logs to find out. If the problem really is some unmapped network folder, you could try switching to UNC paths.

Creating image retention test im builder view

I just downloaded psychopy this morning and have spent the day trying to figure out how to work with builder view. I watched the youtube video "Build your first PsychoPy experiment (Stroop task)" by Jon Pierce. In his video he was explaining how to make a conditions file with excel that would be used in his experiment. I wanted to make a very similar test where images would appear and subjects would be required to give a yes or no answer to them (the correct answer is already predefined). In his conditions file he had the columns 'word' 'colour' and 'corrANS'. I was wondering if instead of a 'word' column, I can have an 'image' column. In this column I would like to upload all my images to them in the same way I would words, and have them correlated to a correct answer of either 'yes' or 'no'. We tried doing this and uploaded images to the conditions file, but we haven't had any success in running the test successfully and were hoping somebody could help us.
Thank you in advance.
P.S. we are not familiar with python, or code in general, so we were hoping to get this running using the builder view.
EDIT: Here is the error message we are receiving when running the program
#### Running: C:\Users\mr00004\Desktop\New folder\1_lastrun.py
4.8397 ERROR Couldn't find image file 'C:/Users/mr00004/Desktop/New folder/PPT Retention 1/ Slide102.JPG'; check path?
Traceback (most recent call last):
File "C:\Users\mr00004\Desktop\New folder\1_lastrun.py", line 174, in
image.setImage(images)
File "C:\Program Files (x86)\PsychoPy2\lib\site-packages\psychopy-1.80.03-py2.7.egg\psychopy\visual\image.py", line 271, in setImage
maskParams=self.maskParams, forcePOW2=False)
File "C:\Program Files (x86)\PsychoPy2\lib\site-packages\psychopy-1.80.03-py2.7.egg\psychopy\visual\basevisual.py", line 652, in createTexture
% (tex, os.path.abspath(tex))#ensure we quit
OSError: Couldn't find image file 'C:/Users/mr00004/Desktop/New folder/PPT Retention 1/ Slide102.JPG'; check path? (tried: C:\Users\mr00004\Desktop\New folder\PPT Retention 1\ Slide102.JPG)
Yes, certainly, that is exactly how PsychoPy is designed to work. Simply place the image names in a column in your conditions file. You can then use the name of that column in the Builder Image component's "Image" field. The appropriate image file for a given trial will be selected.
It is difficult to help you further, though, as you haven't specified what went wrong. "we haven't had any success" doesn't give us much to go on.
Common problems:
(1) Make sure you use full filenames, including extensions (.jpg, .png, etc). These aren't always visible in Windows at least I think, but they are needed by Python.
(2) Have the images in the right place. If you just use a bare filename (e.g. image01.jpg), then PsychoPy will expect that the file is in the same directory as your Builder .psyexp file. If you want to tidy the images away, you could put them in a subfolder. If so, you need to specify a relative path along with the filename (e.g. images/image01.jpg).
(3) Avoid full paths (starting at the root level of your disk): they are prone to errors, and stop the experiment being portable to different locations or computers.
(4) Regardless of platform, use forward slashes (/) not backslashes (\) in your paths.
make a new folder in H drive and fill in the column of image in psychopy as e.g. 'H:\psych\cat.jpg' it works for me