EISDIR: illegal operation on a directory, read in my expo-android - expo

Error: EISDIR: illegal operation on a directory, read
at Object.readSync (fs.js:592:3)
at tryReadSync (fs.js:366:20)
at Object.readFileSync (fs.js:403:19)
at UnableToResolveError.buildCodeFrameMessage (C:\Users\thanu\Downloads\sociallydarkmodeandfollowshare\socially2\node_modules\metro\src\node-haste\DependencyGraph\ModuleResolution.enter
code herejs:304:17)
at new UnableToResolveError (C:\Users\thanu\Downloads\sociallydarkmodeandfollowshare\socially2\node_modules\metro\src\node-haste\DependencyGraph\ModuleResolution.js:290:35)
at ModuleResolver.resolveDependency (C:\Users\thanu\Downloads\sociallydarkmodeandfollowshare\socially2\node_modules\metro\src\node-haste\DependencyGraph\ModuleResolution.js:168:15)
at DependencyGraph.resolveDependency (C:\Users\thanu\Downloads\sociallydarkmodeandfollowshare\socially2\node_modules\metro\src\node-haste\DependencyGraph.js:353:43)
at C:\Users\thanu\Downloads\sociallydarkmodeandfollowshare\socially2\node_modules\metro\src\lib\transformHelpers.js:271:42
at C:\Users\thanu\Downloads\sociallydarkmodeandfollowshare\socially2\node_modules\metro\src\Server.js:1097:37
at Generator.next ()

Related

OpenCV DNN fails reading an ONNX network

I'm trying to load a simple four-layer convolutional neural network from an ONNX file in C++ with OpenCV. The ONNX file was created from a TensorFlow model using the tf2onnx library in Python. I saved the model with the following piece of code.
(onnx_model_proto, storage) = tf2onnx.convert.from_keras(model, opset=8)
with open(os.path.join("models", 'upscaleModelData.onnx'), "wb") as f:
f.write(onnx_model_proto.SerializeToString())
When reading via cv::dnn::Net net = cv::dnn::readNetFromONNX("model.onnx"); in C++, I get the following error.
[ INFO:0] global ####\master_winpack-build-win64-vc15\opencv\modules\dnn\src\onnx\onnx_importer.cpp (429) cv::dnn::dnn4_v20210608::ONNXImporter::populateNet DNN/ONNX: loading ONNX v4 model produced by 'tf2onnx':1.10.0. Number of nodes = 13, inputs = 1, outputs = 1
OpenCV(4.5.3) Error: Unspecified error (Can't create layer "model/tf.nn.depth_to_space/DepthToSpace:0" of type "DepthToSpace") in cv::dnn::dnn4_v20210608::LayerData::getLayerInstance, file ####\opencv\modules\dnn\src\dnn.cpp, line 621
[ERROR:0] global ####\opencv\modules\dnn\src\onnx\onnx_importer.cpp (2127) cv::dnn::dnn4_v20210608::ONNXImporter::handleNode DNN/ONNX: ERROR during processing node with 1 inputs and 1 outputs: [DepthToSpace]:(model/tf.nn.depth_to_space/DepthToSpace:0)
[ INFO:0] global ####\opencv\modules\dnn\src\onnx\onnx_importer.cpp (2131) cv::dnn::dnn4_v20210608::ONNXImporter::handleNode Input[0] = 'model/conv2d_3/Relu:0'
[ INFO:0] global ####\opencv\modules\dnn\src\onnx\onnx_importer.cpp (2135) cv::dnn::dnn4_v20210608::ONNXImporter::handleNode Output[0] = 'model/tf.nn.depth_to_space/DepthToSpace:0'
OpenCV(4.5.3) Error: Unspecified error (> Node [DepthToSpace]:(model/tf.nn.depth_to_space/DepthToSpace:0) parse error: OpenCV(4.5.3) ####\opencv\modules\dnn\src\dnn.cpp:621: error: (-2:Unspecified error) Can't create layer "model/tf.nn.depth_to_space/DepthToSpace:0" of type "DepthToSpace" in function 'cv::dnn::dnn4_v20210608::LayerData::getLayerInstance'
> ) in cv::dnn::dnn4_v20210608::ONNXImporter::handleNode, file ####\opencv\modules\dnn\src\onnx\onnx_importer.cpp, line 2146
OpenCV(4.5.3) ####\opencv\modules\dnn\src\onnx\onnx_importer.cpp:2146: error: (-2:Unspecified error) in function 'cv::dnn::dnn4_v20210608::ONNXImporter::handleNode'
> Node [DepthToSpace]:(model/tf.nn.depth_to_space/DepthToSpace:0) parse error: OpenCV(4.5.3) ####\opencv\modules\dnn\src\dnn.cpp:621: error: (-2:Unspecified error) Can't create layer "model/tf.nn.depth_to_space/DepthToSpace:0" of type "DepthToSpace" in function 'cv::dnn::dnn4_v20210608::LayerData::getLayerInstance'
I'm using OpenCV on Windows and Visual C++.
This might be a similar issue to this: EMGU - EDSR : Can't create layer DepthToSpace.
I tried reading the same network from TensorFlow PB and H5 file, but I get a similar result.
For reading a PB file, created with cv::dnn::readNetFromTensorflow("model.pb") I get:
OpenCV(4.5.3) Error: Unspecified error (FAILED: fs.is_open(). Can't open "model.pb") in cv::dnn::ReadProtoFromBinaryFile, file ####\opencv\modules\dnn\src\caffe\caffe_io.cpp, line 1133
OpenCV(4.5.3) ####\opencv\modules\dnn\src\caffe\caffe_io.cpp:1133: error: (-2:Unspecified error) FAILED: fs.is_open(). Can't open "model.pb" in function 'cv::dnn::ReadProtoFromBinaryFile'
For reading a H5 file created with cv::dnn::readNetFromTensorflow("upscaleModelData.h5"); I get:
OpenCV(4.5.3) Error: Unspecified error (Cannot determine an origin framework of files: model.h5) in cv::dnn::dnn4_v20210608::readNet, file ####\opencv\modules\dnn\src\dnn.cpp, line 5461
OpenCV(4.5.3) ####\opencv\modules\dnn\src\dnn.cpp:5461: error: (-2:Unspecified error) Cannot determine an origin framework of files: model.h5 in function 'cv::dnn::dnn4_v20210608::readNet'
Does this mean I should make modifications to the model's layers so that it can be read by OpenCV? Is this a compatibility issue? Any feedback, workarounds or alternative approaches (e.g. TensorFlow C++ API solutions) are welcome.
Edit 1: Implementing a layer-type workaround
I reimplemented the depth_to_space layer manually in Python, using the following piece of code, based on these links: onnx-tensorflow, depth_to_space, keras-subpixel-conv.
x_shape = tf.shape(x)
n, h, w, c = x_shape[0], x_shape[1], x_shape[2], x_shape[3]
y = tf.reshape(x, (n, h, w, bs, bs, c // (bs ** 2)))
y = tf.transpose(y, (0, 1, 3, 2, 4, 5))
outputs = tf.reshape(y, (n, h * bs, w * bs, c // (bs ** 2)))
Now, when I run the same C++ code, I get the following error.
[ INFO:0] global ####\opencv\modules\dnn\src\onnx\onnx_importer.cpp (429) cv::dnn::dnn4_v20210608::ONNXImporter::populateNet DNN/ONNX: loading ONNX v4 model produced by 'tf2onnx':1.10.0. Number of nodes = 38, inputs = 14, outputs = 1
OpenCV(4.5.3) Error: Assertion failed (indexMat.total() == 1) in cv::dnn::dnn4_v20210608::ONNXImporter::handleNode, file ####\opencv\modules\dnn\src\onnx\onnx_importer.cpp, line 1842
[ERROR:0] global ####\opencv\modules\dnn\src\onnx\onnx_importer.cpp (2127) cv::dnn::dnn4_v20210608::ONNXImporter::handleNode DNN/ONNX: ERROR during processing node with 2 inputs and 1 outputs: [Gather]:(model/tf.compat.v1.shape/Shape:0)
[ INFO:0] global ####\opencv\modules\dnn\src\onnx\onnx_importer.cpp (2131) cv::dnn::dnn4_v20210608::ONNXImporter::handleNode Input[0] = 'Shape__72:0'
[ INFO:0] global ####\opencv\modules\dnn\src\onnx\onnx_importer.cpp (2131) cv::dnn::dnn4_v20210608::ONNXImporter::handleNode Input[1] = 'Const__76'
[ INFO:0] global ####\opencv\modules\dnn\src\onnx\onnx_importer.cpp (2135) cv::dnn::dnn4_v20210608::ONNXImporter::handleNode Output[0] = 'model/tf.compat.v1.shape/Shape:0'
OpenCV(4.5.3) Error: Unspecified error (> Node [Gather]:(model/tf.compat.v1.shape/Shape:0) parse error: OpenCV(4.5.3) ####\opencv\modules\dnn\src\onnx\onnx_importer.cpp:1842: error: (-215:Assertion failed) indexMat.total() == 1 in function 'cv::dnn::dnn4_v20210608::ONNXImporter::handleNode'
> ) in cv::dnn::dnn4_v20210608::ONNXImporter::handleNode, file ####\opencv\modules\dnn\src\onnx\onnx_importer.cpp, line 2146
OpenCV(4.5.3) ####\opencv\modules\dnn\src\onnx\onnx_importer.cpp:2146: error: (-2:Unspecified error) in function 'cv::dnn::dnn4_v20210608::ONNXImporter::handleNode'
> Node [Gather]:(model/tf.compat.v1.shape/Shape:0) parse error: OpenCV(4.5.3) ####\opencv\modules\dnn\src\onnx\onnx_importer.cpp:1842: error: (-215:Assertion failed) indexMat.total() == 1 in function 'cv::dnn::dnn4_v20210608::ONNXImporter::handleNode'

How to fix "assertion 'GDK_IS_SCREEN (screen)' failed" error in GTK+2

I'm trying to write a short C program, that makes all programs reload the GTK+2 theme, the way that LXAppearance does, when you click on apply.
Looking at LXAppearance's source code I found a function that does just that. The same function (without an if-else that only applies to LXSession) is also found in gtk-theme-switch.
This is the code written as a separate program:
#include <gtk/gtk.h>
int main()
{
GdkEventClient event;
event.type = GDK_CLIENT_EVENT;
event.send_event = TRUE;
event.window = NULL;
event.message_type = gdk_atom_intern("_GTK_READ_RCFILES", FALSE);
event.data_format = 8;
gdk_event_send_clientmessage_toall((GdkEvent*)&event);
}
When running the program I the following error:
(process:3428): Gdk-CRITICAL **: 21:38:49.599: IA__gdk_screen_get_root_window: assertion 'GDK_IS_SCREEN (screen)' failed
Segmentation fault (core dumped)
What am I doing wrong?
You've not initialized GTK. At the very least, to access your current X display with GTK, you need to call the gtk_init function before doing any other X-related things.

Segmentation Fault on fprintf iofputs.c: No such file or directory

I have the following code:
FILE* fp;
if(value.empty())
return ID;
fp=fopen((tmpDir+"/"+filename).c_str(),"a");
string sID="";
if(ID>-1){
sID=to_string(ID)+"\t";
}
string row=sID+drawingID+"\t"+data+"\n";
fprintf(fp,"%s",row.c_str());
fclose(fp);
Under GDB, the code fails with the following errors:
Program received signal SIGSEGV, Segmentation fault.
__GI__IO_fputs (str=0x4a864 "1000001\t0\t70\t1\n", fp=0x0) at iofputs.c:38
38 iofputs.c: No such file or directory.
You did not check the result of fopen.
according to the error message fpis 0, meaning fopen has failed.
I would guess, the tmpDir is non-existent or non-accessable, or the file does not exist, yet.

Old fortran code and getting an OPEN statement error using GNU

I'm trying to compile a very old code but I get this error while compiling the code
Error: Syntax error in OPEN statement at (1)
The code:
WRITE(LUTTO,'('' TYPE NAME OF FILE CONTAINING INPUT : '',$)')
C READ (LUTTI,'(Q,A)') NCHAR,FILNAM
READ (LUTTI,'(A)') FILNAM
NCHAR = len_trim(FILNAM)
C ----- OPEN DATA FILE -----
print *, "NCHAR"
OPEN( UNIT = LUINP, NAME = FILNAM(1:NCHAR),
$ STATUS = 'OLD', RECL = 80 ,
$ CARRIAGECONTROL= 'LIST', ERR = 9900 )
name=... in the open statement is invalid
try file=... instead

C++ "expected primary-expression before ‘(’ token" error

I have this code:
FILE *f = fopen(intPath, "r");
Node *n;
if (f) {
try {
n = parse(f, intPath);
} catch (SyntaxError e) {
fclose(f); /***** line 536 *****/
throw LangException(
builtin_classes::exception_class::create_ImportError(
String::fromAscii(e.filename)->
append(String::fromAscii(":"))->
append(String::fromInt(e.line))->
append(String::fromAscii(":"))->
append(String::fromInt(e.col))->
append(String::fromAscii(": syntax error: "))->
append(String::fromAscii(e.message))
);
}
fclose(f);
return n->eval(scope);
} else {
throw LangException(
builtin_classes::exception_class::create_ImportError(
String::fromAscii("failed to open file for reading")
),
line,
col
);
}
And the compiler gives this error:
nodes.cpp:537:40: error: expected primary-expression before ‘(’ token
nodes.cpp:544:94: error: expected ‘)’ before ‘;’ token
I have no clue what it could be, especially since that code sample has another statement which does the same thing, and it doesn't cause an error.
throw LangException(
builtin_classes::exception_class::create_ImportError(
String::fromAscii(e.filename)->
append(String::fromAscii(":"))->
append(String::fromInt(e.line))->
append(String::fromAscii(":"))->
append(String::fromInt(e.col))->
append(String::fromAscii(": syntax error: "))->
append(String::fromAscii(e.message))
) // This closes the function call
; // You didn't close the throw here!
Your ( and your ) don't match in that large, first throw LangException block.
The compiler tells you what is wrong. The throw LangException( doesn't have a ).
Exactly what it says. You are missing a ‘)’ before ‘;’ token on that line.
LangException(...
is not closed.