Skip to main content

Error importing directive module "tables" (directive "csv-table")

Posted in

Hi Guys

Thanks for making this cool tool available. I have a vanilla machine with a vanilla installation that does open the canvas but the stats does not seem to work. Can see the data in the data Inputs but fail from any step onwards.

ERROR: Error importing directive module "tables" (directive "csv-table")

Information: New 64Bit Windows 7 Machine with no previous python version or Qt etc. installed. Tested with data from custom files and data from R-datasets

Suspicion: DocUtils ... Don't know if it is build / compile related, but due to me not having the python environment and docutils installed I suspect it might be related to either:
1. build / compile related
2. Hierarchy structure / reference / system path - variables/ folder related
3. something else ...

I apologise for not supplying a fix or better debugging information ... Have not installed Python and an IDE yet.

POSSIBLE worst case solution: Install Python and IDE. Download development latest trunk. Compile and Debug if I can reproduce after Python / DocUtils installation.

LOG:

<string>:24: (ERROR/3) Error importing directive module "tables" (directive "csv-table"):
No module named csv
<string>:24: (ERROR/3) Unknown directive type "csv-table".

.. csv-table:: Main Parameters
  :header: "Parameter","Value"

  "Data Table","See Below"


<string>:34: (ERROR/3) Error importing directive module "tables" (directive "csv-table"):
No module named csv
<string>:34: (ERROR/3) Unknown directive type "csv-table".

.. csv-table::
  :header: "Sepal.Length","Sepal.Width","Petal.Length","Petal.Width","Species"

  "7.0","3.2","4.7","1.4","versicolor"
  "6.4","3.2","4.5","1.5","versicolor"

etc....

Kind Regards
PS - Please let me know if I can supply any related information or if you have any questions related to this

same problem when generating reports

I get these same errors in the body of the report. This is my first time trying red-r and I just loaded the sample firstSchema.rrs and hit the "generate report" button and accepted all the checked boxes. Perhaps these errors are expected -- I don't have a good idea really of what the report ought to look like. (If someone could post the correct report generated by this example that would be most useful too.)

With max log settings I get the same errors in the log under the bin directory (red-RCanvas.exe.log)

By the way are there any other examples I could download and try? I know there are some video tutorials but it would be nice to be able to open some sample files.

Congrats on a very nice product; I'm looking forward to understanding and using it.

:24: (ERROR/3) Error importing directive module "tables" (directive "csv-table"):
No module named csv
:24: (ERROR/3) Unknown directive type "csv-table".

.. csv-table:: Main Parameters
:header: "Parameter","Value"

"Data Table","See Below"

:34: (ERROR/3) Error importing directive module "tables" (directive "csv-table"):
No module named csv
:34: (ERROR/3) Unknown directive type "csv-table".

.. csv-table::
:header: "Sepal.Length","Sepal.Width","Petal.Length","Petal.Width","Species"

"7.0","3.2","4.7","1.4","versicolor"

etc.

Docutils

I think the csv-table is a normal part of docutils.

I'm testing the documentation functions for Red-R now.

It would be helpful in isolating this problem to either the Red-R parser which makes the .rst file or the docutils parser which parses the .rst file if you could find and upload the .rst file for the document you want to generate. This should be in a directory with the same name as the file you wanted to generate in the same directory as the destination directory for that file.

If you upload that, (or paste in) I'll test to see if docutils can even build it and then work back from there.

Thanks
Kyle

RE: docutils

Like I said, I got this result just loading the one example file that comes with the distribution ( firstSchema.rrs ) and then hitting "generate report." If you do that, what do you get?

I cannot find any .rst file either in the directory where the .odt was generated, nor under the red-r install directory (C:\program files\...) nor under the red-r application data directory (C:\documents and settings\...\Application Data\red-r)

Thanks,
Steve

(How do I upload a file to the forum -- I don't see any upload button or link?)

Attaching files

Apparently we can't attach files to a forum comment. But you can start a new forum topic and attach there then link back to this post.

Thanks

rst file

The file should be in a directory with the same name as your report. So if you wanted to save as "test.odt" in Documents there should be a directory:

Documents/test

and a file

Documents/test.odt

The test.rst file should be in Documents/test/test.rst

I don't know if this was changed in the latest version and haven't had a chance to test yet. It if doesn't save to a file I'll put this feature back in because docutils can be called independently of Red-R.

Thanks for your comments. I'll see if I can figure out what is wrong. I've tested reports in the upcoming version and they seem to be working well but I've never seen the csv-table error so I'd like to try to isolate this and fix.

Thanks again for reporting this error.

One thing is if you really want to make the report, just find all tables in the output and don't report on them. I think for the example file it would be the view data table and row filtering widgets.

I guess you can't attach things in the forum (I'll try to fix this too). You can email me directly ().

Kyle

rst file

No, the report is in my Documents directory but there is no subdirectory with the report name and no rst file in any subdirectory (I've searched using the unix (cygwin) 'find' which I trust more than the windows search.)

As I said I'm a complete newbie this was my first attempt to use Red-R so I don't really know what the report ought to look like. If you could post the correct report generated by the Example that would be very useful.

Thanks for all your help,
Steve

OK. That feature must have

OK. That feature must have been removed for some reason. I'm adding it back.

I'll compile the rst file and put it up but it seems that there is some problem with the docutils directive for csv tables. I'll test this on my machine here to see if I can reporduce. I just haven't had time to get to that yet.

At the moment, you may not be able to generate reports with any tables in them. There are still lots of other features in Red-R that you might find useful for data exploration or statistics. We're testing the next version now and will be sure to extensively test the report generation components. If you are working on things that will require reports in the future just save the files and then open them in the next version to make the reports.

Thanks for testing the beta version of Red-R and for reporting this issue. I'll put up the document that I get in another post (since we can't upload files with comments...) and link to this post as well.

Kyle

Red R version: Latest ..Error importing directive module "tables

Forgot to mention the Red-R version: 1.85b

I have the latest Red R version installed. (And then tried the previous version with the update ... but seems that it doesn't resolve that)

Please let me know if you need anymore information

Installers

  • Red-R-1.85b-2011.05.18.r1361.exe
  • Red-R-1.85b-Update-2011.05.18.r1361.exe
  • Red-R-1.85b-2011.05.10.r1339.exe

Thanks

Docutils error

Hi crashmaniac,

I'm interested in how you are getting this error. The docutils code is only touched when either report generation is requested or printing is requested. Could you set your output verbosity to DEVEL (do this in the options menu [gear button]) and copy the output from the output window and post? If possible also get a screen capture so it's easier to see the connections.

If you have an install on a win or mac then Python and Docutils comes precompiled in the installer.

Thanks for reporting this issue.
Kyle

Docutils more information

Hi Kyle

I have re-installed Red R by running the installer as administrator. I still get the same error when generating reports.

However the plot and R-datasets somehow now shows /works (after re-installation as admin)

I have attached the output but please be advised that the log (not the output) contains the error without any other information. (Please note that this error is shown in the generated document itself ... If you want to I can send this via email to you or attach it somewhere ... just point me in the general direction)

I can foresee myself using Red much more often in future (From an IDE /source code environment) so if I debug and track errors, is this forum suitable to submit a bug and maybe a code fix/suggestion?

OUTPUT:

REDRCORE:INFO : Make a new tab called General.
REDRCORE:INFO : Create new widget named R Datasets.
R:INFO : Loading library datasets.
REDRWIDGET:INFO : Data sent from slot id0
REDRCORE:INFO : Create new widget named View Data Table.
REDRCORE:INFO : Possible Connections are [('id0', 'id1')]
REDRCORE:INFO : Add connection between R Datasets and View Data Table.
R:INFO : Loading library ggplot2.
R:INFO : Loading library hexbin.
REDRCORE:INFO : Create new widget named Barplot (GGPLOT).
REDRCORE:INFO : Possible Connections are [('id0', 'id0')]
REDRCORE:INFO : Add connection between R Datasets and Barplot (GGPLOT).
REDRCORE:CRITICAL :

############################################################
Unhandled exception of type RuntimeError occured at 2011-06-28 07:28:18.068000:
Traceback:
  File: krcggplotbarplot.py, line 145 in commitFunction
    File: OWRpy.py, line 140 in R
      RuntimeError: Error in `$<-.data.frame`(`*tmp*`, "None", value = integer(0)) : replacement has 0 rows, data has 84 <br>Original Query was: boxplotData_3_1309238838.11$None<-factor(boxplotData_3_1309238838.11$None, levels = c(''))
############################################################


REDRWIDGET:INFO : Data sent from slot id0
REDRCORE:CRITICAL :

############################################################
Unhandled exception of type RuntimeError occured at 2011-06-28 07:29:44.704000:
Traceback:
  File: krcggplotbarplot.py, line 102 in xGroupChanged
    File: OWRpy.py, line 140 in R
      RuntimeError: Error in function (file = "", n = NULL, text = NULL, prompt = "?", srcfile = NULL, : unexpected '$' in "is.factor($" <br>Original Query was: is.factor($time)
############################################################


REDRCORE:CRITICAL :

############################################################
Unhandled exception of type RuntimeError occured at 2011-06-28 07:30:07.737000:
Traceback:
  File: krcggplotbarplot.py, line 98 in fillDataChanged
    File: OWRpy.py, line 140 in R
      RuntimeError: Error in function (file = "", n = NULL, text = NULL, prompt = "?", srcfile = NULL, : unexpected '$' in "is.factor($" <br>Original Query was: is.factor($conc)
############################################################


REDRCORE:CRITICAL :

############################################################
Unhandled exception of type RuntimeError occured at 2011-06-28 07:30:14.782000:
Traceback:
  File: krcggplotbarplot.py, line 98 in fillDataChanged
    File: OWRpy.py, line 140 in R
      RuntimeError: Error in function (file = "", n = NULL, text = NULL, prompt = "?", srcfile = NULL, : unexpected '$' in "is.factor($" <br>Original Query was: is.factor($time)
############################################################


REDRCORE:CRITICAL :

############################################################
Unhandled exception of type RuntimeError occured at 2011-06-28 07:30:19.298000:
Traceback:
  File: krcggplotbarplot.py, line 98 in fillDataChanged
    File: OWRpy.py, line 140 in R
      RuntimeError: Error in function (file = "", n = NULL, text = NULL, prompt = "?", srcfile = NULL, : unexpected '$' in "is.factor($" <br>Original Query was: is.factor($None)
############################################################


REDRCORE:INFO : Create new widget named Generic Plot.
REDRCORE:INFO : Create new widget named Bar Plot.
REDRCORE:INFO : Removing Widget
REDRCORE:INFO : Create new widget named Scatterplot.
REDRCORE:INFO : Possible Connections are [('id0', 'id0')]
REDRCORE:INFO : Add connection between R Datasets and Scatterplot.
REDRCORE:DEBUG : Widget instances are [, , , , ]
save in orngDoc RedRScatterplot
REDRCORE:DEBUG : moving to saveRedRScatterplot
REDRCORE:DEBUG : Type is not supported at the moment..
{'status': 0, 'text': PyQt4.QtCore.QString(u'New Data Received')}
save in orngDoc RDataTable
REDRCORE:DEBUG : moving to saveRDataTable
{'status': 0, 'text': PyQt4.QtCore.QString(u'New Data Received')}
saving list box
{'items': OrderedDict([('', 'Google'), ('http://en.wikipedia.org/w/index.php?title=Special:Search&search=%s', 'Wikipedia')]), 'selected': []}
REDRCORE:DEBUG : Type is not supported at the moment..
save in orngDoc plot
REDRCORE:DEBUG : moving to saveplot
save in orngDoc krcggplotbarplot
REDRCORE:DEBUG : moving to savekrcggplotbarplot
saving list box
{'items': OrderedDict(), 'selected': []}
{'status': 0, 'text': PyQt4.QtCore.QString(u'New Data Received')}
saving list box
{'items': OrderedDict(), 'selected': []}
REDRCORE:DEBUG : Type is not supported at the moment..
save in orngDoc RedRdata
REDRCORE:DEBUG : moving to saveRedRdata
REDRCORE:DEBUG : Type is not supported at the moment..
{'status': 2, 'text': PyQt4.QtCore.QString(u'Data Processed And Sent')}
R:DEBUG : save.image("C:/Users/evdeventer/AppData/Roaming/red-r/RedRTemp/temp_1309238544.45/tmp.RData")
can not convert NULL yet
REDRCORE:INFO : Document Saved Successfully to C:/Users/evdeventer/Documents/Red-R/Schemas/test.rrs
REDRCORE:DEBUG : Widget instances are [, , , , ]
R:DEBUG : as.matrix(as.data.frame(Indometh)[1:50,])
R:DEBUG : colnames(as.data.frame(Indometh))
Error in saving image in graphicsView
R:DEBUG : as.matrix(datasets_1_1309238582.58[1:50,])
R:DEBUG : colnames(datasets_1_1309238582.58)
widget name Scatterplot
widget name R Datasets
widget name Generic Plot
widget name Barplot (GGPLOT)
widget name View Data Table

Kind Regards

Docutils error

Thanks for sending the output.

Several of these errors seem to be generated because there is no data actually sent to the barplot widget. If you are connecting datasets to barplot you will need to press the commit button. I will put hooks into barplot now that will prevent the majority of the errors that you are seeing.

The installer is also supposed to give the user read write access to the directory into which it is installed but you will need admin privalages to do that at install time. I'll also put a hook into the installer to check if the user is admin and not allow installation if the user is not admin.

We're putting out a new installer with several other bug fixes in a few days that I have been testing report generation on and have had no problems, so hopefully that will fix the report generation issues. I don't see in the output above where document generation failed. The document generator needs to write a csv table to a file and then read that back in using docutils so if you didn't have admin rights that might have failed. If you see where that is happening I'd be really interested in seeing the output there too.

If you are interested in making the developer environment for Red-R you can adapt the directions for the linux installer to your machine. The dependencies are Python, R, PtQt, PyQwt, and Docutils. Then svn checkout our trunk or one of the releases, set the working directory to the checkout directory/canvas and execute python red-RCanvas.pyw

When setting up the directory structure it should be like this.

.
./R/R-2.11.1
./RedRCheckout

This is a fine place to submit error reports to, this way others can search them and find answers.

Thanks for the interest in Red-R
Kyle

Docutils error

Thanks Kyle, appreciate the response.

I will be on the lookout for the new installer. Thanks for the tips.

Will be providing more feedback on Red-R as time goes by (Had a few [non Red-R or R related] big issues with my local database with data consolidation onto my local machine and busy sorting that out)

Thus delaying checking out the code from the repository for now. Also delaying setting up a development environment as I want to see how the install goes so that I can provide positive feedback :)

And then I might need to come up with a strategy with handling big volumes of data in R without running out of memory (Am actually pondering adding(or developing) a layer in R to handle larger volumes of data more efficiently - using similar concepts implemented by Qlickview)

Kind Regards

Memory in R

Yeh, R has it's memory problems. We have some packages for working with data in databases that might be interesting for you. Never heard of Qlickview but I'll check on it. There are a few packages for working with large data sets in R also but I haven't worked with them much.

Kyle