HDF5 call 'file = H5Fopen(nuceos_table_name, H5F_ACC_RDONLY, H5P_DEFAULT)' returned error code -1 - hdf5

when I run an executable on Linux I met an error I'm not able to explain. The executable is meant to read an .h5 file whose name is given by the nuceos_table_name variable. I already checked the filename and should be right i.e. nuceos_table_name = "./BLH_new.h5", the file is in the same folder where I launch the command from ("srun <path-to-executable>"). The error is the following
HDF5-DIAG: Error detected in HDF5 (1.12.0) thread 0:
#000: H5F.c line 793 in H5Fopen(): unable to open file
major: File accessibility
minor: Unable to open file
HDF5-DIAG: Error detected in HDF5 (1.12.0) thread 0:
HDF5-DIAG: Error detected in HDF5 (1.12.0) thread 0:
#000: H5F.c line 793 in H5Fopen(): unable to open file
major: File accessibility
minor: Unable to open file
HDF5-DIAG: Error detected in HDF5 (1.12.0) thread 0:
#000: H5F.c line 793 in H5Fopen(): unable to open file
major: File accessibility
minor: Unable to open file
#001: H5VLcallback.c line 3500 in H5VL_file_open(): open failed
major: Virtual Object Layer
minor: Can't open object
Thank you for helping and sorry if I haven't been clear enough, I'm new to this computer science stuff, anyway I'm here to explain better.
P.S. The code fragment which opens the file is the following:
void nuc_eos_C_ReadTable(const cGH* cctkGH)
{
DECLARE_CCTK_PARAMETERS;
using namespace nuc_eos;
using namespace nuc_eos_private;
CCTK_VInfo(CCTK_THORNSTRING,"*******************************");
CCTK_VInfo(CCTK_THORNSTRING,"Reading nuc_eos table file:");
CCTK_VInfo(CCTK_THORNSTRING,"%s",nuceos_table_name);
CCTK_VInfo(CCTK_THORNSTRING,"*******************************");
CCTK_INT my_reader_process = reader_process;
if (my_reader_process < 0 || my_reader_process >= CCTK_nProcs(cctkGH))
{
CCTK_VWarn(CCTK_WARN_COMPLAIN, __LINE__, __FILE__, CCTK_THORNSTRING,
"Requested IO process %d out of range. Reverting to process 0.", my_reader_process);
my_reader_process = 0;
}
const int doIO = !read_table_on_single_process || CCTK_MyProc(cctkGH) == my_reader_process;
hid_t file;
if (doIO && !file_is_readable(nuceos_table_name)) {
CCTK_VError(__LINE__, __FILE__, CCTK_THORNSTRING,
"Could not read nuceos_table_name %s \n",
nuceos_table_name);
}
HDF5_DO_IO(file = H5Fopen(nuceos_table_name, H5F_ACC_RDONLY, H5P_DEFAULT));
// Use these two defines to easily read in a lot of variables in the same way
// The first reads in one variable of a given type completely

Related

Getting Error while reading a manual_test.csv file in Jupyter. (Data and warehouse mining, Machine Learning)

I am trying to run a cell in Jupyter notebook and getting permission error number 13. The code is
df_manual_testing = pd.concat([df_fake_manual_testing,df_true_manual_testing], axis = 0)
df_manual_testing.to_csv("manual_testing.csv")
The error which I am getting is:
---------------------------------------------------------------------------
PermissionError Traceback (most recent call last)
<ipython-input-16-f14a4d175882> in <module>
1 df_manual_testing = pd.concat([df_fake_manual_testing,df_true_manual_testing], axis = 0)
----> 2 df_manual_testing.to_csv("manual_testing.csv")
~\anaconda\lib\site-packages\pandas\core\generic.py in to_csv(self, path_or_buf, sep, na_rep, float_format, columns, header, index, index_label, mode, encoding, compression, quoting, quotechar, line_terminator, chunksize, date_format, doublequote, escapechar, decimal)
3202 decimal=decimal,
3203 )
-> 3204 formatter.save()
3205
3206 if path_or_buf is None:
~\anaconda\lib\site-packages\pandas\io\formats\csvs.py in save(self)
182 close = False
183 else:
--> 184 f, handles = get_handle(
185 self.path_or_buf,
186 self.mode,
~\anaconda\lib\site-packages\pandas\io\common.py in get_handle(path_or_buf, mode, encoding, compression, memory_map, is_text)
426 if encoding:
427 # Encoding
--> 428 f = open(path_or_buf, mode, encoding=encoding, newline="")
429 elif is_text:
430 # No explicit encoding
PermissionError: [Errno 13] Permission denied: 'manual_testing.csv'
I cannot understand how to change the permission of my file. I think so I will need to change it from root to user, but I am not sure exactly how to do this.
If you are not interested in writing the csv file into the current working directory, you could simply specify the full path of a folder in which you are sure you have the permissions to write.
For example:
df_manual_testing.to_csv("C:/Users/../manual_testing.csv")
However, if you want to write in a particular folder, you can check from the terminal if you have the permissions to write here, using the command ls -lh. Eventually, you could change the permissions using the account of the owner of the folder, with the command chmod 777 myfolder.
If you need more information about file permissions, you could look at this reference.

Why I get a problem that tells me to set the value to float, and when I do I get I need to set it to integer?

I'm trying to save a recording of camera, Im using a free course, and it says, I need to create cv2.VideoWriter.
the problem I get when I try is:
Traceback (most recent call last):
File ..., line 10, in <module>
writer = cv2.VideoWriter(filename,cv2.VideoWriter_fourcc(*'DVIX'),20,(width,height))
TypeError: a float is required
my code:
import cv2
import numpy as np
cap = cv2.VideoCapture(0)
width = cap.get(cv2.CAP_PROP_FRAME_WIDTH)
height = cap.get(cv2.CAP_PROP_FRAME_HEIGHT)
#### THE PROBLEM IS IN THIS LINE ########
writer = cv2.VideoWriter("images/my_super_vid.mp4",cv2.VideoWriter_fourcc(*'DVIX'),20,(width,height))
######################################
while True:
ret, frame = cap.read()
#OPERTAIONS (DRAWING ETC')
writer.write(frame)
cv2.imshow("frame",frame)
if cv2.waitKey(1) & 0xFF == ord('q'):
break
cap.release()
writer.release()
cv2.destroyAllWindows()
I saw the problem and I changed it to:
writer = cv2.VideoWriter("images/my_super_vid.mp4",cv2.VideoWriter_fourcc(*'DVIX'),float(20),(width,height))
and even:
writer = cv2.VideoWriter("images/my_super_vid.mp4",cv2.VideoWriter_fourcc(*'DVIX'),20.0,(width,height))
but in both of those tries I got:
Traceback (most recent call last):
File "....", line 10, in <module>
writer = cv2.VideoWriter("images/my_super_vid.mp4",cv2.VideoWriter_fourcc(*'DVIX'),20.0,(width,height))
TypeError: integer argument expected, got float
I don't know how to fix it, I tried solutions I saw in the internet but none of them worked..
got the same problem
okay I changed the line to:
writer = cv2.VideoWriter("images/my_super_vid.avi",cv2.VideoWriter_fourcc(*'XVID'),20, (int(width),int(height)))
and it worked. but now I get:
qt.qpa.plugin: Could not find the Qt platform plugin "cocoa" in ""
This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.
when I try to run it in PyCharm
FIXED IT: just ran it from terminal.
The errors are referring to different values on the same line in the parentheses. The first value has to be a float and second an int (or vice versa)

Fail to run the example in the OpenCV tutorial of Load Caffe framework models

I've tried the example in the opencv_contrib tutorial of dnn: http://docs.opencv.org/master/d5/de7/tutorial_dnn_googlenet.html
But it return two errors, I've search for hours and didn't get any solution. Does anyone could give me some help?
OpenCV Error: Assertion failed (retval == 0) in cv::ocl::Kernel::set, file D:\opencv32\opencv\modules\core\src\ocl.cpp, line 3366
OpenCV Error: Assertion failed (The following error occured while making forward() for layer "loss3/classifier": retval == 0) in cv::ocl::Kernel::set, file D:\opencv32\opencv\modules\core\src\ocl.cpp, line 3366

PyBBIO Analog Input: Failure to Load ADC File

While running the PyBBIO examples phant_test.py and analog_test.py I received the following error (I believe 'could' is a typo meant to be 'could not'):
Traceback (most recent call last):
File "analog_test.py", line 47, in <module>
run(setup, loop)
File "/usr/lib/python2.7/site-packages/PyBBIO-0.9-py2.7-linux-armv7l.egg/bbio/bbio.py", line 63, in run
loop()
File "analog_test.py", line 37, in loop
val1 = analogRead(pot1)
File "/usr/lib/python2.7/site-packages/PyBBIO-0.9-py2.7-linux-armv7l.egg/bbio/platform/beaglebone/bone_3_8/adc.py", line 46, in analogRead
raise Exception('*Could load overlay for adc_pin: %s' % adc_pin)
Exception: *Could load overlay for adc_pin: ['/sys/devices/ocp.2/PyBBIO-AIN0.*/AIN0', 'PyBBIO-AIN0', 'P9.39']
I have tried restarting the BeagleBone (rev A6 running Angstrom with a 3.8 kernel, with no capes connected) to clear the /sys/devices/bone_capemgr.7/slots file, but that did not work. It seems PyBBIO is accessing the slots file and adding overlays because the slots file looks like this after the example program runs:
0: 54:PF---
1: 55:PF---
2: 56:PF---
3: 57:PF---
4: ff:P-O-L Override Board Name,00A0,Override Manuf,PyBBIO-ADC
5: ff:P-O-L Override Board Name,00A0,Override Manuf,PyBBIO-AIN0
Since there were some changes being made to the slots file I checked what files the analog_read(adc_pin) function in the adc.py file of PyBBIO was retrieving. With some print statements I figured out the root problem was that the /sys/devices/ocp.2/PyBBIO-AIN0.*/AIN0 file, which apparently stores the analog read values, does not exist. The glob.glob function returns a null array, and ls /sys/devices/ocp.2/PyBBIO-AIN0.10/ shows modalias power subsystem uevent as the only contents. Is there something wrong in the overlay file? Or could there be another program or problem that is preventing the BeagleBone from writing the AIN0 file that PyBBIO is trying to read? The python code seems to be logically correct, but the overlay is working incorrectly or being blocked in some way.

HDF5 error from MEEP on Ubuntu

I have installed MEEP, everything is running fine however when I try to run this tutorial code for the straight waveguide I get the following message:
-----------
Initializing structure...
Working in 2D dimensions.
Computational cell is 16 x 8 x 0 with resolution 10
block, center = (0,0,0)
size (1e+20,1,1e+20)
axes (1,0,0), (0,1,0), (0,0,1)
dielectric constant epsilon diagonal = (12,12,12)
time for set_epsilon = 0.0840669 s
-----------
creating output file "./eps-000000.00.h5"...
HDF5-DIAG: Error detected in HDF5 (1.8.4) thread 3078944464:
#000: ../../../src/H5F.c line 1430 in H5Fcreate(): unable to create file
major: File accessability
minor: Unable to open file
#001: ../../../src/H5F.c line 1220 in H5F_open(): unable to open file
major: File accessability
minor: Unable to open file
#002: ../../../src/H5FD.c line 1079 in H5FD_open(): open failed
major: Virtual File Layer
minor: Unable to initialize object
#003: ../../../src/H5FDsec2.c line 365 in H5FD_sec2_open(): unable to open file
major: File accessability
minor: Unable to open file
#004: ../../../src/H5FDsec2.c line 365 in H5FD_sec2_open(): Permission denied
major: Internal error (too specific to document in detail)
minor: System error message
meep: error on line 450 of ../../../src/h5file.cpp: error opening HDF5 output file
It looks like a permission error. Do you have write permission in the current directory? Or does the file ./eps-000000.00.h5 already exists and cannot be overwritten?

Resources