Hide keyboard shortcuts

Hot-keys on this page

r m x p   toggle line displays

j k   next/prev highlighted chunk

0   (zero) top of page

1   (one) first highlighted chunk

1""" 

2 pyexcel_io.exceptions 

3 ~~~~~~~~~~~~~~~~~~~~~~ 

4 

5 all possible exceptions 

6 

7 :copyright: (c) 2014-2020 by Onni Software Ltd. 

8 :license: New BSD License, see LICENSE for more details 

9""" 

10 

11 

12class NoSupportingPluginFound(Exception): 

13 """raised when an known file extension is seen""" 

14 

15 pass 

16 

17 

18class SupportingPluginAvailableButNotInstalled(Exception): 

19 """raised when a known plugin is not installed""" 

20 

21 pass 

22 

23 

24class IntegerAccuracyLossError(Exception): 

25 """ 

26 When an interger is greater than 999999999999999, ods loses its accuracy. 

27 

28 from pyexcel import Sheet, get_sheet 

29 s = Sheet() 

30 s[0,0] = 999999999999999 # 15 '9's 

31 print(s) 

32 s.save_as('abc.ods') 

33 b=get_sheet(file_name='abc.ods') 

34 b[0,0] == s[0,0] 

35 

36 s = Sheet() 

37 s[0,0] = 9999999999999999 # 16 '9's 

38 print(s) 

39 s.save_as('abc.ods') 

40 b=get_sheet(file_name='abc.ods') 

41 b[0,0] != s[0,0] 

42 """ 

43 

44 def __init__(self, message): 

45 custom_message = ( 

46 message 

47 + "\n" 

48 + "In order to keep its accuracy, please save as string. Then " 

49 + "convert to int, long or float after the value will be read back" 

50 ) 

51 

52 super(IntegerAccuracyLossError, self).__init__(custom_message)