So today all of a sudden R does not read my excel files. I made absolutely no change on my computer.
My working directory is "C:/Users/Ilias Iliadis/OneDrive/Documents" (i got this with getwd() ).
This is the error message that is displayed: Error in read.xlsx.default("GerBiogas") : File does not exist.
GerBiogas is the file i am trying to load. I am absolutely sure it is in the correct folder and i spell it properly. The file is also in xlsx form. I unistalled and reinstalled R but the problem remains.
Do you have any idea was is going on? All of a sudden i cannot load any of my files.
I am trying to load it with this:
read.xlsx("GerBiogas")
i also tried to specify the path: DT <- read.xlsx("C:\Users\Ilias Iliadis\OneDrive\Documents\GerBiogas.xlsx")
Again it does not work. I am using R version 4.2.2.
Related
I am experiencing a funny problem: I am developing an ionic app, using cordova-plugin-file to store images. The resulting paths (URIs in form file:///...) are stored in a SQLite DB along with more information. When I install the app and use it, all works perfect. But if I update (or reinstall) the app, the old images are not found anymore, while newly added images work perfect.
I first suspected that the image files were being deleted on update, but I checked the content of the directory and the files are still there. (FYI: I am using file.dataDirectory/scans/ to place my files).
Then I thought that maybe I could go around the problem loading into img src a base64 blob loaded with cordova.file.readAsUrl(), but cordova.file does not find the file as well (I insist, the files are there, I checked with XCode).
So I checked further with cordova.file and it only finds files that are added after last app install, but the older files are still present in the directory.
Here my code:
private getImgSrcFromDocument(doc: Document): any {
const uri = doc.fileName;
const src = this.webView.convertFileSrc(uri);
const sanitized = this.sanitizer.bypassSecurityTrustUrl(src);
console.log({uri, src, sanitized});
return sanitized;
}
<img class="document_thumbnail" [src]="getImgSrcFromDocument(doc)">
I have already checked this, but is not my case.
By the way, the same code works perfect on Android.
Any idea what could be the problem?
Thanks in advance!
I found the reason why and the solution (very obvious when you know the problem):
Reason
On every new install, iOS renames the data directory for the app. The directory path has this form:
file:///var/mobile/Containers/Data/Application/ABC0000-1234-99DD-00FA-E835FEA/Library/NoCloud/
The hash in the middle is renewed on every install, so the stored full paths in DB are not valid anymore.
Solution
If you still can do it (no deploy yet, no real users), store only the relative path and complete it every time with this.file.dataDirectory (or wherever you wanted to store your files).
If you already have real users and want your update to 'find the files', just ignore the first part of the stored path and build it like before:
const ValidUri = this.file.dataDirectory + // The injected cordova-plugin-file
'relativeSubDirectories/' + // If you store your files in some subdirectory
this.document.storedFullPath.substr( // Take from fullPath only the filename
this.document.storedFullPath.lastIndexOf('/') + 1
);
Where storedFullPath is the string file:///var/mobile/....
After that, you still have to do the webView conversion and the sanitizing, like in the question above.
Hope this helps someone.
I'm using tesseract to detect text in spanish in some screenshot of a game, I had some issues with the "spa.traineddata" so I started to train my own data called "spa1.traineddata" and I used the two files to make text detection more accurate, yesterday I make some tests and seemed to work well, but the file "spa1.traineddata" needed more training, so I decided to continue today, I added some new images to train my file "spa1.trainneddata" and then I wanted to test it and throws me the following error
pytesseract.pytesseract.TesseractError: (1, 'Error opening data file C:\\Program Files\\Tesseract-OCR/tessdata/-l spa.traineddata Please make sure the TESSDATA_PREFIX environment variable is set to your "tessdata" directory. Failed loading language \'-l spa\' Error opening data file /home/debian/src/github/tesseract-ocr/tesseract/bin/ndebug/x86_64-w64-mingw32-5.0.0-alpha.20200223/usr/x86_64-w64-mingw32/share/tessdata/spa1 --psm
6.traineddata Please make sure the TESSDATA_PREFIX environment variable is set to your "tessdata" directory. Failed loading language \'spa1 --psm 6\' Tesseract couldn\'t load any languages! Could not initialize tesseract.')
and these are the lines of code that I use for testing
custom_config = r'-l spa+spa1 --psm 6'
pytesseract.image_to_string(Image.open('imagenes/obv.png'), lang=custom_config)
I was searching and found that the error was because the lang.traideddata files were not in the tessdata folder, but mine are in the folder (That's why I was able to work with them yesterday)
I attach a screenshot of the tessdata folder, the last two files are the traineddata
tessdata folder
also, it is useful I'm using vscode, python 3.7 and tesseract 4
I hope you can help me (sorry my bad english uwu)
I am using Spreadsheet to parse xls files. It's working great. but today one of my user has uploaded a file and it's getting an error "unknown encoding name - MACINTOSH"
My code is:
book = Spreadsheet.open file_path
sheet1 = book.worksheet 0
This is the excel file which is getting the error:
https://www.dropbox.com/s/jv37pk5rpiy9259/testlisttextnonames2.xls
Can you guys please help me to solve this issue.
Running into the same problem. Here is the best i can deduce:
"Macintosh" is not a known encoding in Ruby 1.9+. Try opening a console and running "Encoding.find('Macintosh')". You'll get the same error.
So what is available? In the console: "Encoding.list". One of the options is MacRoman. I'm guessing this is a close second.
So if we change the mapping in lib/spreadsheet/excel/internals.rb for 10000 and 32768 to map to "MACROMAN", it should work.
Tested locally and it does.
I opened a pull request: https://github.com/zdavatz/spreadsheet/pull/51
Some reference links:
* https://en.wikipedia.org/wiki/Mac_OS_Roman
* http://bugs.python.org/issue843590
I recently had to start making small changes to an existing site so I downloaded it and tried to run it but get an error:
Call to undefined method sfContext::getController() in
/home/user/www/site.com/web/index.php on line 16
I tried to figure out which file is being loaded by inserting these lines with this command in index.php right before the dispatch call.
$reflection = new ReflectionClass('sfContext');
$classFile = $reflection->getFileName();
die($classFile);
sfContext::getInstance()->getController()->dispatch();
And it looks like file loaded is:
/home/user/www/site.com/lib/vendor/symfony1.0/test/unit/sfContextMock.class.php
This symfony1.0 site works fine on original server but not on my local machine.
I checked php version and php.ini and they are identical. I cant figure out why wrong class is being loaded or what the problem is.
Here is the index.php file
<?php
define('SF_ROOT_DIR', realpath(dirname(__FILE__).'/..'));
define('SF_APP', 'front');
define('SF_ENVIRONMENT', 'prod');
define('SF_DEBUG', true);
require_once(SF_ROOT_DIR.DIRECTORY_SEPARATOR.'apps'.DIRECTORY_SEPARATOR.SF_APP.DIRECTORY_SEPARATOR.'config'.DIRECTORY_SEPARATOR.'config.php');
sfContext::getInstance()->getController()->dispatch();
You should update to the lastest one available (1.0.22).
Ok so I feel that I have finally successfully used the OpenCV libraries in my app, except for one thing...
My .yml files get generated correctly except the '%YAML:1.0' header at the top turns out like this '01%YAML:1.0'. The '01' infront of the header is causing this error (I think):
OpenCV Error: Parsing error (/var/mobile/Applications/53C6CBA3-15B7-436A-892B-2ECFA75B72CD/Library/DownloadedDescriptors/descriptors.yml(1): Valid XML should start with '<?xml ...?>') in icvXMLParse, file /Users/Dash/Documents/SmartServices/AirLink/ProjectGhost/FairfaxNewsDemo/opencv-2.3.1/OpenCV-2.3.1/modules/core/src/persistence.cpp, line 2163
Anyone know how to solve this issue?
Ok after looking into it a bit further I dont think it's the headers problem. My file always gets generated with '01' at the start.
Hmm...this is embarrassing. But it turns out that I had a 'print' statement lingering in the php file that helps generate my .yaml file, causing 0 and 1 to be added to the beginning of the document.
This meant that my file didn't start with '%YAML:1.0' as expected but '01%YAML:1.0'