Page 1 of 1

I got this error while importing pgn

Posted: Tue Feb 21, 2017 7:42 pm
by uyasar
Hello,
I ve got this error while importing pgn:
Fatal error: Uncaught exception 'Exception' with message 'Fen: 8/pp1q1p1Q/n2P1kp1/2p1R1N1/5P2/P1P5/6PP/6K1 b - - 0 10 color: black notation: Qh8 Rank: File: 0, ' in /home/mobilderslik/eders.org/wp-content/plugins/dhtml_chess/api/php/parser/FenParser0x88.php:1327 Stack trace: #0 /home/mobilderslik/eders.org/wp-content/plugins/dhtml_chess/api/php/parser/FenParser0x88.php(1169): FenParser0x88->getFromAndToByNotation('Qh8+') #1 /home/mobilderslik/eders.org/wp-content/plugins/dhtml_chess/api/php/parser/GameParser.php(50): FenParser0x88->getParsed(Array) #2 /home/mobilderslik/eders.org/wp-content/plugins/dhtml_chess/api/php/parser/GameParser.php(34): GameParser->parseAMove(Array) #3 /home/mobilderslik/eders.org/wp-content/plugins/dhtml_chess/api/php/parser/GameParser.php(57): GameParser->parseMoves(Array) #4 /home/mobilderslik/eders.org/wp-content/plugins/dhtml_chess/api/php/parser/GameParser.php(47): GameParser->parseVariations(Array) #5 /home/mobilderslik/eders.org/wp-content/plugins/dhtml_chess/api/php/parser/GameParser.php( in /home/mobilderslik/eders.org/wp-content/plugins/dhtml_chess/api/php/parser/FenParser0x88.php on line 1327

Re: I got this error while importing pgn

Posted: Tue Feb 21, 2017 8:40 pm
by alf
Send me the pgn(you have my email) and I will take a look at it. It's a problem parsing one of the games.

Re: I got this error while importing pgn

Posted: Wed Feb 22, 2017 2:43 pm
by uyasar
It is art_attack pgn from the demo folder

Re: I got this error while importing pgn

Posted: Wed Feb 22, 2017 2:49 pm
by alf
Ah ok :) I will fix that tonight.

Some pgns are buggy. I will modify the code for the pgn to JSON parser so that it gracefully ignores games it can't understand. I will of course also try to fix the parser if there's a bug in it.

Re: I got this error while importing pgn

Posted: Wed Feb 22, 2017 5:23 pm
by alf
The plugin has been updated with a temporary fix for this problem.

It occurred because of NULL moves in the pgn, i.e. things like:

9... -- 10. Re5 (notice the --)

I have not yet implemented support for NULL moves, but I have added it to my Trello boards of upcoming tasks.

The temporary bugfix is to ignore games the parser can't understand, i.e it imports the rest of the games without any errors. It's a better user experience than throwing a FATAL error.

Re: I got this error while importing pgn

Posted: Thu Mar 16, 2017 10:30 am
by Idochesswork
Hi alf,

Whenever I import pgn, it missed the first game.
Then I try to remove the database by swiping it, and go to Archived Database to delete it and reload another time (same file), and now, the game in database are enough. Is this a bug, or just me have that problem?

Re: I got this error while importing pgn

Posted: Thu Mar 16, 2017 11:03 am
by alf
If you're missing a game, there could be a problem with your pgn(or the DHTML Chess parser).

If you post the first few games of the pgn here, I will try it out with the parser to see if there are any problems.

When you import games into DHTML Chess, there is a parser which analyses the game and stores the game in the database in a computer-readable format(JSON). There has been some issues in the past where the parser could not understand the PGN. I have fixed most of these issues, but there may be other problems.

Re: I got this error while importing pgn

Posted: Fri Mar 17, 2017 8:03 am
by Idochesswork
I tried once again, to see if the problem would occur or not. And it's just the same. The game editor just show 29, instead of 30 exercises, and it missed the first one.

http://pastebin.com/ZuQxhjfh

It's not a critical problem. However, I think that in our Game Editor, you can add a function to rearrange the order of database's game, so that we can manually enter the game, the position and then rearrange it to the order that fit best. I.e: "+" button to move a selected game up, and "-" button to move it down.

Thank you Alf,
Warm regards,

Re: I got this error while importing pgn

Posted: Fri Mar 17, 2017 6:56 pm
by alf
Thanks for providing a link to the pgn.

I have tested the pgn now, and cannot find any problems with it. I get 30 games when I import the pgn. I'm also getting 30 games parsed when I test it directly with the PGN to JSON PHP parser.

Re: I got this error while importing pgn

Posted: Mon Mar 20, 2017 2:23 pm
by Idochesswork
Hi alf,

Thank you for taking a look. Maybe it's because of my web server. :)