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

csvkmd error #21

Closed
ShaunDarkLord opened this issue Sep 9, 2019 · 4 comments
Closed

csvkmd error #21

ShaunDarkLord opened this issue Sep 9, 2019 · 4 comments

Comments

@ShaunDarkLord
Copy link

When trying to sync guardians, I recieve the following error;

"Traceback (most recent call last):
File "gam.py", line 41763, in ProcessGAMCommand
File "gam.py", line 4747, in getEntityToModify
File "gam.py", line 4573, in getEntitiesFromCSVbyField
File "gam.py", line 2324, in openCSVFileReader
File "csv.py", line 98, in fieldnames
_csv.Error: line contains NULL byte"

This was running fine back in May, when I ran some test scripts. I have even tried using the same CSV I used back in May, but get the same result.

@ShaunDarkLord
Copy link
Author

The command I'm running is;
gam.exe csvkmd users guardians.csv keyfield Student datafield Guardian sync guardians csvdata Guardian

@taers232c
Copy link
Owner

I can reproduce the error by putting a NULL byte at the end of the header row.
I'll have GAM trap the error but all that will achieve is a better error message.
How was guardians.csv produced?

$ od -xc guardians.csv                                                                                                                                                                                                                                                                                                                   
0000000      7453    6475    6e65    2c74    7547    7261    6964    6e61                                                                                                                                                                                                                                                                
           S   t   u   d   e   n   t   ,   G   u   a   r   d   i   a   n                                                                                                                                                                                                                                                                 
0000020      0a00    6574    7473    7375    7265    4031    6472    6373                                                                                                                                                                                                                                                                
          \0  \n   t   e   s   t   u   s   e   r   1   @   r   d   s   c                                                                                                                                                                                                                                                                 
0000040      6f68    6c6f    6f2e    6772    742c    7365    7574    6573                                                                                                                                                                                                                                                                
           h   o   o   l   .   o   r   g   ,   t   e   s   t   u   s   e                                                                                                                                                                                                                                                                 
0000060      3272    7240    7364    6863    6f6f    2e6c    726f    0067                                                                                                                                                                                                                                                                
           r   2   @   r   d   s   c   h   o   o   l   .   o   r   g                                                                                                                                                                                                                                                                     
0000077                                                                                                                                                                                                                                                                                                                                  

$ gam csvkmd users guardians.csv keyfield Student datafield Guardian sync guardians csvdata Guardian

ERROR: line contains NULL byte

@ShaunDarkLord
Copy link
Author

Hi Ross

It was created by the commandreporter function of SIMS.net (an MIS system used by many UK schools).

@ShaunDarkLord
Copy link
Author

I adjusted my script to recreate the CSV - It's working now - Thank you!

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

2 participants