godfat / cultivate

0 stars 0 forks source link

Showing the error file #7

Open ac9607 opened 5 years ago

ac9607 commented 5 years ago

When I do a large batch work(>100 files), an error occurred. But I'm not able to find the file caused error.

wangyps-MacBook-Pro-2:cultivate wangyp$ ./bin/import /Users/wangyp/Documents/cultivate/dataall Traceback (most recent call last): 11: from ./bin/import:7:in <main>' 10: from /Users/wangyp/Documents/cultivate/lib/cultivate.rb:11:intraverse' 9: from /Users/wangyp/Documents/cultivate/lib/cultivate.rb:11:in each' 8: from /Users/wangyp/Documents/cultivate/lib/cultivate.rb:15:inblock in traverse' 7: from /Users/wangyp/Documents/cultivate/lib/cultivate.rb:15:in each' 6: from ./bin/import:8:inblock in

' 5: from /Users/wangyp/Documents/cultivate/lib/cultivate/model.rb:20:in import' 4: from /Users/wangyp/Documents/cultivate/lib/cultivate/model.rb:20:ininject' 3: from /Users/wangyp/Documents/cultivate/lib/cultivate/model.rb:20:in each' 2: from /Users/wangyp/Documents/cultivate/lib/cultivate/model.rb:29:inblock in import' 1: from /Users/wangyp/Documents/cultivate/lib/cultivate/model.rb:57:in process' /Users/wangyp/Documents/cultivate/lib/cultivate/model.rb:65:inrescue in process': undefined local variable or method `path' for Cultivate::Patient:Class (NameError) wangyps-MacBook-Pro-2:cultivate wangyp$

godfat commented 5 years ago

Oh, that's broken due to previous rework. path wasn't defined. Should be fixed at https://github.com/godfat/cultivate/commit/f05e6338aed251512d7fcd32d5913dfb235de8de

However, we could see that it only happens when Sequel::NotNullConstraintViolation is raised, meaning that we have some other problems to solve...

ac9607 commented 5 years ago

I still unable to identified the error file? Or should I read the log file?

wangyps-MacBook-Pro-2:~ wangyp$ cd /Users/wangyp/Documents/cultivate_1120 wangyps-MacBook-Pro-2:cultivate_1120 wangyp$ ./bin/big5-to-utf8 /Users/wangyp/Documents/cultivate_1120/dataall20181120 wangyps-MacBook-Pro-2:cultivate_1120 wangyp$ ./bin/import /Users/wangyp/Documents/cultivate_1120/dataall20181120 Traceback (most recent call last): 9: from ./bin/import:7:in <main>' 8: from /Users/wangyp/Documents/cultivate_1120/lib/cultivate.rb:11:intraverse' 7: from /Users/wangyp/Documents/cultivate_1120/lib/cultivate.rb:11:in each' 6: from /Users/wangyp/Documents/cultivate_1120/lib/cultivate.rb:15:inblock in traverse' 5: from /Users/wangyp/Documents/cultivate_1120/lib/cultivate.rb:15:in each' 4: from ./bin/import:8:inblock in

' 3: from /Users/wangyp/Documents/cultivate_1120/lib/cultivate/model.rb:20:in import' 2: from /Users/wangyp/Documents/cultivate_1120/lib/cultivate/model.rb:40:inload_rows' 1: from /Users/wangyp/Documents/cultivate_1120/lib/cultivate/model.rb:50:in load_csv' /Users/wangyp/Documents/cultivate_1120/lib/cultivate/model.rb:50:ingsub': invalid byte sequence in UTF-8 (ArgumentError)

godfat commented 5 years ago

@ac9607 Sorry for the wait. This should print the filename and ignore that file: https://github.com/godfat/cultivate/commit/ea47701a55ef65dfa8af8214f3724fd30242b6a3