Ticket #15 (new wish)

Opened 7 years ago

Last modified 6 years ago

Load File wizard

Reported by: janez Owned by:
Milestone: Future Component: library
Severity: minor Keywords:
Cc: Blocking:
Blocked By:

Description

Zelo koristno bi bilo pripraviti wizard, ki bi ti pomagal, kadar se file ne nalozi. Glavni problem pri uporabi Orangea je priprava filea s podatki in napake so navadno trivialne, vendar uporabnika odbije, ker mu stvar ze v zacetku ne dela. Stvar bi naredili, za zaceteke, za .tab file.

"Orange seems to have a trouble with your data file. This wizard can help you find the problem." "cancel, next"

try:

f = file(filename, "rt")

except:

"""File cannot be opened for reading: it either doesn exist or another application (such as Excel, if you are using Windows, doesn allow opening it.""" "ok"

firstline = f.readline() while (not firstline or firstline[0]=="|" or not firstline.trim()) and not f.eof():

firstline = f.readline()

if f.eof():

"""Your file seems to be empty or it only contains comments (lines starting with character |). Please open it in an ASCII editor and check this"""

attr_names = firstline.split("\t")

if len(attr_names) <= 1:

"""The first line should contain a list of attribute names, separated with tabulators. There are not tabulators in your first line, so it would appear to have only one attribute. If this is correct, press "Next".

Otherwise, if you have prepared the file using a spreadsheet application, such as Excel, make sure that you have saved it as tab-delimited. If you have prepared it using an ASCII editor, verify whether you used tabulators and whether your editor keeps them (some editors can be set to replace tabulators with spaces).

Do we need to go ahead?"""

"no, next"

"""Your file has %i attributes (possibly including the class attribute), named as shown in the table below. Is this correct?"""

"no, yes"

no-> """If you miss some attributes or some attribute names are merged into a single attribute,

there must be something wrong with the tabulators that should be separating them. If you have prepared the file using a spreadsheet application, such as Excel, make sure that you have saved it as tab-delimited. If you have prepared it using an ASCII editor, verify whether you used tabulators and whether your editor keeps them (some editors can be set to replace tabulators with spaces)."""

secondline = f.readline() while (not secondline or secondline[0]=="|" or not secondline.trim()) and not f.eof():

secondline = f.readline()

if f.eof():

"""Your file seems to contain nothing but the attribute names. Please open it in an ASCII editor and check this"""

attr_types = secondline.split("\t")

if len(attr_types)==1 and len(attr_names)==1 and secondline.count(" "):

"""There are no tabulators in the second line, which gives the attribute types. You have more than one attribute, hence the number of attribute types mismatches the number of attributes.

Is it possible that you have separated attributes types with spaces instead of with tabulators? Anyway, we have found the problem; fix this and try again."""

"ok"

if len(attr_types > len(attr_names):

"""There are more attribute types than attribute names. Please open the file in an ASCII editor or, even better, in a spreadsheet, such as Excel, and locate the problem"""

if len(attr_types) < len(attr_names):

"""The number of attribute types (the second line) is smaller than the number of attributes (that is, the number of attribute names in the first line). The table shows which type went with each attribute; locate the source of mismatch and fix the corresponding entry in the file"""

!now check the attribute types, put them in t y again."""

"""Orange was unfortunately unable to determine the source of your problem. Please consult the documentation on file format and the error message returned by the data loader (%s) to try to fix the problem yourself.

If your data is not confidential you can also send us the file (or a part of it; include a small portion which still does not load), and we can try to make this wizard smarter."""

Change History

comment:1 Changed 7 years ago by janez

  • Severity changed from major to minor

comment:2 Changed 6 years ago by janez

  • Owner set to janez
  • Component set to core
  • Milestone changed from 1.0 to future

comment:3 Changed 6 years ago by janez

  • Owner janez deleted
Note: See TracTickets for help on using tickets.