Jump to content
TNG Community

CPI error - 1950 DOM


MadRanger

Recommended Posts

Ken,

I drew this error during an attempted 1950 DOM import (attached):

Fatal error: Uncaught TypeError: fread(): Argument #1 ($stream) must be of type resource, bool given in C:\xampp\htdocs\genealogy\cpscrapeALL.php:75 Stack trace: #0 C:\xampp\htdocs\genealogy\cpscrapeALL.php(75): fread(false, false) #1 {main} thrown in C:\xampp\htdocs\genealogy\cpscrapeALL.php on line 75

Line 75 reads: $html = fread($fh, filesize($myFile));

TNG v14.0.3

CPI v14.0.1.13c

I have had plenty of continued success with CPI since upgrading to v14. (I even managed for the first time to add to an exiting transcriptID.)

Regis

DOM Source of Selection.htm

Link to comment
Share on other sites

Regis,

That error message is indicating that the 'fread' function is expecting the first argument ($stream) to be a resource type, but it's receiving a boolean ('false') instead.

That error usually occurs when the file handle ('$fh') is not properly opened or is not a valid resource.?? Your "attempted" import file might be corrupted or perhaps it's out of date, from where you downloaded it.??? You should check to ensure that the file can be opened successfully first, before attempting to download and then read from it on your computer.

Make sure that:

a) The file path is correct on the site. (path may have changed, it happens)

b) The file has the appropriate permissions for reading.

c) The file can be successfully opened first, before attempting to read from it.

By checking those basic aspects, you should be able to resolve your issue.

Drew

Link to comment
Share on other sites

Drew,

Thank you for your reply. The file being imported was created via the documented CPI procedure and was saved to the same folder on my PC/XAMPP that I always use (transcriptsource). The DOM file was mere seconds old when imported. I did not open any DOM file before importing - the file was always saved in text format per the established procedure and always imported. Until it did not this time.

As I recall, an earlier (1930?) DOM was reported to have already been imported, and that would have precluded that 1930-DOM file from being deleted per one of the several CPI options. In saving the 1950 DOM, a popup asked if the existing DOM should be overwritten - to which I checked Yes/OK in the "save as" format still (as always) set to "text." And that is where I called timeout - Drew was having me challenge the way things worked with the remark "it happens." I found that somehow, the undeleted DOM file ceased to be a text file and was now an html file which of course will not import. Why the "save-as text" did not result in a text DOM I cannot explain. (I can have a Word doc named DOM and an XLS file named DOM with no issue, but the DOM was not was saved as html despite the stipulated text format.)

As a departure from my norm, instead of accepting the default "DOM Source of Selection," I appended text to the default DOM name during the save process and the 1950 record was then successfully imported. I was interrupted by supper preparation and have not moved beyond that 1950 import to see what develops with the next import. The transcriptsource folder is now empty, so the documented process should resume with the "save as" still set to text. I'll resume testing this issue later in the day.

Thank you again, Drew.

Link to comment
Share on other sites

Regis,

The file you posted imports correctly on my WampServer environment using PHP 7.4.33  

What TNG version are you using?  Some of your previous posts indicate that your XAMPP is using TNG 13 and not 14.  So exactly what are you using on your XAMPP environment?  You cannot using the v14 of the mod on TNG v13.

 

Link to comment
Share on other sites

Ken,

I am using TNG v14.0.3 with PHP 8.2.4 and CPI 14.0.1.13c.

Theses are the files I deleted from the transcipture folder so that I could save/import a 1950 DOM. The one annotate issue & issuex2 are the problematic files - one of which I sent to you.

image.png

Link to comment
Share on other sites

Ken,

Continuing with the discrepancies between how I saved the DOM and what was saved. I rebooted the PC and still the DOM were being saved as htm files. I restored my copy of the file I previously sent to you and while I could not change the file type, I could/did change what program opened the file. And, yep, I then got the DOM to register "as already in the database."

Continuing with Drew's - "it happens." And it did. How the program designated to open the DOM file changed from Notepad to Firefox is unknown. But, it appears that I have regrouped - subsequent DOM are being saved, read and imported properly.

Thank you and Drew - again.

Regis

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...