Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot open file on Mac OS #326

Open
ben55j opened this issue Feb 21, 2024 · 0 comments
Open

Cannot open file on Mac OS #326

ben55j opened this issue Feb 21, 2024 · 0 comments

Comments

@ben55j
Copy link

ben55j commented Feb 21, 2024

Hello,

I am trying this package on MacOs for reading at an .xlsx file located in "./test/example.xlsx" (same level as the lib folder).

Here is my code for getting the file.

testExcel(int` counter) async {

  var file = './test/example.xlsx';
  var bytes = File(file).readAsBytesSync();
  var excel = Excel.decodeBytes(bytes);
  //....
  }

But, for some reason, the app cannot access to it ..and I dont understand why.

Here is the error I get:

[ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: PathNotFoundException: Cannot open file, path = './test/example.xlsx' (OS Error: No such file or directory, errno = 2)
#0      _File.throwIfError (dart:io/file_impl.dart:675:7)
#1      _File.openSync (dart:io/file_impl.dart:490:5)
#2      _File.readAsBytesSync (dart:io/file_impl.dart:574:18)
#3      testExcel (package:us_manager/main.dart:90:26)
#4      _MyHomePageState._incrementCounter (package:us_manager/main.dart:42:5)
#5      _InkResponseState.handleTap (package:flutter/src/material/ink_well.dart:1183:21)
#6      GestureRecognizer.invokeCallback (package:flutter/src/gestures/recognizer.dart:275:24)
#7      TapGestureRecognizer.handleTapUp (package:flutter/src/gestures/tap.dart:652:11)
#8      BaseTapGestureRecognizer._checkUp (package:flutter/src/gestures/tap.dart:309:5)
#9      BaseTapGestureRecognizer.handlePrimaryPointer (package:flutter/src/gestures/tap.dart:242:7)

Can you help?
Many Thanks
Benjamin

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant