Re: importing existing project

38 views
Skip to first unread message

Todd Greenwood-Geer

unread,
Nov 29, 2012, 10:14:34 PM11/29/12
to leo-e...@googlegroups.com
I tried with a much smaller project, <10 files.

1. Imported files using script as below
2. files imported, as in, nodes are created in leo

http://imgur.com/ocKrT
http://imgur.com/pF6hx

But only the nodes are created, i don't see anything in the body pane for the actual file content. Is there a second step here?

-Todd

On Thursday, November 29, 2012 8:51:30 PM UTC-5, Todd Greenwood-Geer wrote:
My apologies if this is a double post...I posted a few hours ago, but I don't see what I posted...re-typing a shorter version here:

As a test, I imported a project with ~400 java files into leo. Couple of things:

1. This takes a long time to import
2. When I hit Ctrl-S to save, I'm asked if I want to over-write each file
3. I have to subsequently kill the leo process b/c canceling won't get me out of this

I followed the advice here for importing:
http://comments.gmane.org/gmane.comp.python.leo.general/20173

So... am I doing something wrong here?

------------------------------
import script
------------------------------

import os


@others


types = ('.py', '.java', '.scala', '.sh', '.build', '.gradle', '.html', '.js')

theDir = r'.'


if g.os_path_exists(theDir):

importFiles(theDir,types,recursive=True)

g.es("done",color="blue")

else:

g.es("directory does not exist: " + theDir)


-Todd

Matt Wilkie

unread,
Nov 30, 2012, 2:08:41 AM11/30/12
to leo-e...@googlegroups.com
Hi Todd,

I received all 3 of your messages, so, coming through loud and clear. :)

I think there are one or more files in your project structure which Leo's parser is stumbling on, after creating the outline hierarchy and before populating the contents. Try drag'n'drop files from your file manager into Leo's outline pane in groups of 10 (or whatever) until you localise which one(s) are problematic.


I get the same results: the structure is created but the @auto nodes are empty.

I then ran "File > Read/Write > Read @auto nodes", and got errors of type "not found: @auto B:\apps\leo-editor\leo\core\AliasFeatureclassConversion.py" for every file. These weren't reported before, and the path is wrong. They should be "@auto b:\code\maphew\gis\...".

I changed back to full path, `theDir =  r'b:\code\maphew\gis'`, then re-ran the script, got the same empty nodes, then "Read @auto nodes". This time the first 7 files were read, the node structure and body contents populated as expected, and then it stopped with an error:

{{{
reading: @auto gdal_vrtmerge.py
Error: intermixed blanks and tabs
exception executing command
Traceback (most recent call last):
  File "B:\apps\leo-editor\leo\core\leoCommands.py", line 561, in doCommand
    val = command(event)
  File "B:\apps\leo-editor\leo\core\leoCommands.py", line 1930, in readAtAutoNodes
    c.importCommands.readAtAutoNodes()
  File "B:\apps\leo-editor\leo\core\leoImport.py", line 934, in readAtAutoNodes
    c.atFileCommands.readOneAtAutoNode(fileName,p)
  File "B:\apps\leo-editor\leo\core\leoAtFile.py", line 857, in readOneAtAutoNode
    ic.createOutline(fileName,parent=p.copy(),atAuto=True)
  File "B:\apps\leo-editor\leo\core\leoImport.py", line 904, in createOutline
    func(s,p,atAuto=atAuto)
  File "B:\apps\leo-editor\leo\core\leoImport.py", line 1565, in scanPythonText
    scanner.run(s,parent)
  File "B:\apps\leo-editor\leo\core\leoImport.py", line 3364, in run
    if self.strict: s = self.regularizeWhitespace(s)
  File "B:\apps\leo-editor\leo\core\leoImport.py", line 3427, in regularizeWhitespace
    self.report(message)
  File "B:\apps\leo-editor\leo\core\leoImport.py", line 2681, in report
    if self.strict: self.error(message)
  File "B:\apps\leo-editor\leo\core\leoImport.py", line 2675, in error
    g.error('Error:',s)
  File "B:\apps\leo-editor\leo\core\leoGlobals.py", line 2636, in error
    g.es_print(color=g.actualColor('red'),*args,**keys)
  File "B:\apps\leo-editor\leo\core\leoGlobals.py", line 2714, in es_print
    g.pr(*args,**keys)
  File "B:\apps\leo-editor\leo\core\leoGlobals.py", line 2850, in pr
    sys.stdout.write(s2)
IOError: [Errno 9] Bad file descriptor
}}}

There might be more going on with this file, because Leo normally says something like "Error: intermixed blanks and tabs. Inserting @ignore" and carries on. In any case I fixed that file and then "Read @auto nodes" on the "import fies" tree worked (albeit complaining about mixed tabs and spaces in other files too).

These files are also at http://code.google.com/p/maphew/source/browse/gis/ for anyone who wants to dig further. I'll leave them unchanged for awhile.

cheers,

-matt

Matt Wilkie

unread,
Nov 30, 2012, 2:10:05 AM11/30/12
to leo-e...@googlegroups.com
> I get the same results: the structure is created but the @auto nodes are empty.

that should read: I get the same results using "Recursive create @auto nodes"...

Todd Greenwood-Geer

unread,
Dec 1, 2012, 9:55:04 AM12/1/12
to leo-e...@googlegroups.com, Matt Wilkie
@All -
The key info that I was missing was the need to actually read in the
@auto nodes. There is so much to leo, and the docs are so rich, that
some key pieces of information are lost in all that. I'll do what I can
to help on this as I learn leo.


@Matt -
I tried importing your dataset, leo log below.

It seems that you have whitespace errors in your python files. For
instance, in fusion.py, you have whitespace before a newline at line 54:

Original file...

52 u' def __init__(self,geoTr):\n'
53 u' self.set(geoTr)\n'
54 u' \n'
55 u' def __str__(self):\n'
56 u' s = str(self.toList())\n'

Imported file...

52 u' def __init__(self,geoTr):\n'
53 u' self.set(geoTr)\n'
54 u'\n'
55 u' def __str__(self):\n'
56 u' s = str(self.toList())\n'

Other files have different errors...

reading: @auto gdal_vrtmerge.py
error: intermixed blanks and tabs
error: inconsistent leading whitespace. tabs converted to blanks


Thanks for the help, you unblocked me!

-Todd

---------------------------
leo.log
---------------------------
saved: workbook.leo
done
reading: @auto AliasFeatureclassConversion.py
reading: @auto list-fc-aliases.py
reading: @auto xx-set-alias.py
reading: @auto fusion.py
error: @auto did not import @auto fusion.py perfectly
first mismatched line: 54 (original) = 54 (imported)
Original file...

52 u' def __init__(self,geoTr):\n'
53 u' self.set(geoTr)\n'
54 u' \n'
55 u' def __str__(self):\n'
56 u' s = str(self.toList())\n'

Imported file...

52 u' def __init__(self,geoTr):\n'
53 u' self.set(geoTr)\n'
54 u'\n'
55 u' def __str__(self):\n'
56 u' s = str(self.toList())\n'
inserting @ignore
errors inhibited read @auto
/home/todd/temp/maphew/maphew-3bdfb2adb6d9/gis/gdal_extras/bin/fusion.py
reading: @auto gdal_vrtmerge.py
error: intermixed blanks and tabs
error: inconsistent leading whitespace. tabs converted to blanks
inserting @ignore
errors inhibited read @auto
/home/todd/temp/maphew/maphew-3bdfb2adb6d9/gis/gdal_extras/bin/gdal_vrtmerge.py
reading: @auto gdalcopyproj.py
reading: @auto gdalsetnull.py
reading: @auto Tool_BrightContrastGamma.py
error: intermixed blanks and tabs
error: inconsistent leading whitespace. tabs converted to blanks
warning: underindented python comments.
Extra leading whitespace will be added
# box.pack_start(but)
warning: underindented python comments.
Extra leading whitespace will be added
# box.pack_start(but)
inserting @ignore
errors inhibited read @auto
/home/todd/temp/maphew/maphew-3bdfb2adb6d9/gis/gdal_extras/tools/Tool_BrightContrastGamma.py
reading: @auto cyg-apt.py
error: inconsistent leading whitespace. tabs converted to blanks
inserting @ignore
errors inhibited read @auto
/home/todd/temp/maphew/maphew-3bdfb2adb6d9/gis/o4w_extras/bin/cyg-apt.py
reading: @auto gdal-makeworld.py
reading: @auto apt.py
finished
> --
> You received this message because you are subscribed to the Google
> Groups "leo-editor" group.
> To post to this group, send email to leo-e...@googlegroups.com.
> To unsubscribe from this group, send email to
> leo-editor+...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/leo-editor?hl=en.


--
Todd Greenwood-Geer

Matt Wilkie

unread,
Dec 2, 2012, 2:03:48 AM12/2/12
to leo-e...@googlegroups.com
> It seems that you have whitespace errors in your python files. For instance, in fusion.py, you have whitespace before a newline at line 54:

I guess this is a pretty good indication I haven't actually worked with them for some time. ;-)

I'm glad to have helped get you unblocked.

-matt
Reply all
Reply to author
Forward
0 new messages