liuyang1520 / django-command-extensions

Automatically exported from code.google.com/p/django-command-extensions
MIT License
0 stars 0 forks source link

trying to generate the png file, filename too long #9

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
just trying to get the png file for my model, but I got this exception:

IOError: [Errno 36] File name too long: u'digraph name {   fontname = 
"Helvetica

using this command:
    python manage.py graph_models -a -g -o my_project_visualized.png

don't know if is something important or just my mistake!

Original issue reported on code.google.com by rober...@gmail.com on 16 May 2008 at 9:41

GoogleCodeExporter commented 8 years ago
The exact command line works for me. (Debian/Linux Django-trunk)

Could you post the entire exception please ?
Please also post some more detail on the platform/installation your using. (OS /
Python version / Django version / pygraphviz version / etc)

It somehow looks like part of the dotty templates is ending up in the filename, 
which
is very strange. 

Original comment by v.oostv...@gmail.com on 19 May 2008 at 10:30

GoogleCodeExporter commented 8 years ago
Hi, the generation of PNG output doesn't works for me too... I uses:

 * Ubuntu 8.04
 * Python 2.5
 * Django 0.97-pre-SVN-7554
 * graphviz 2.16-3ubuntu2
 * python-pygraphviz 0.35.dfsg-1ubuntu1

The exception:

{{{
$ ./manage.py graph_models -a -o teste.png
Traceback (most recent call last):
  File "./manage.py", line 11, in <module>
    execute_manager(settings)
  File "/home/semente/lib/python/site-packages/django/core/management/__init__.py",
line 272, in execute_manager
    utility.execute()
  File "/home/semente/lib/python/site-packages/django/core/management/__init__.py",
line 219, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/home/semente/lib/python/site-packages/django/core/management/base.py", line
72, in run_from_argv
    self.execute(*args, **options.__dict__)
  File "/home/semente/lib/python/site-packages/django/core/management/base.py", line
86, in execute
    output = self.handle(*args, **options)
  File
"/home/semente/lib/python/site-packages/extensions/management/commands/graph_mod
els.py",
line 32, in handle
    self.render_output(dotdata, **options)
  File
"/home/semente/lib/python/site-packages/extensions/management/commands/graph_mod
els.py",
line 45, in render_output
    graph = AGraph(' '.join(dotdata.split("\n")).strip())
  File "/var/lib/python-support/python2.5/pygraphviz/agraph.py", line 63, in __init__
    self.read(file)
  File "/var/lib/python-support/python2.5/pygraphviz/agraph.py", line 920, in read
    fh=self._get_fh(path)
  File "/var/lib/python-support/python2.5/pygraphviz/agraph.py", line 1186, in _get_fh
    fh = file(path,mode=mode)
IOError: [Errno 36] File name too long: u'digraph name {   fontname = 
"Helvetica"  
fontsize = 8    node [     fontname = "Helvetica"     fontsize = 8     shape =
"plaintext"   ]   edge [     fontname = "Helvetica"     fontsize = 8   ]        

Message [label=<     <TABLE BGCOLOR="palegoldenrod" BORDER="0" CELLBORDER="0"
CELLSPACING="0">      <TR><TD COLSPAN="2" CELLPADDING="4" ALIGN="CENTER"
BGCOLOR="olivedrab4"      ><FONT FACE="Helvetica Bold" COLOR="white"     
>Message</FONT></TD></TR>                        <TR><TD ALIGN="LEFT" 

[...]

            User -> Group     [label="groups"] [arrowhead=normal arrowtail=normal]; 
             User -> Permission     [label="user_permissions"] [arrowhead=normal
arrowtail=normal];                       Permission -> ContentType    
[label="content_type"] ;                                                        

      LogEntry -> User     [label="user"] ;               LogEntry -> ContentType   
 [label="content_type"] ;                            CasaLegislativa -> Municipio   
 [label="cidade"] ;               CasaLegislativa -> Telefone     [label="telefones"]
[style="dotted"] [arrowhead=normal arrowtail=normal];                     
 ContatoInterlegis -> CasaLegislativa     [label="casa_legislativa"] ;              
ContatoInterlegis -> Telefone     [label="telefones"] [style="dotted"]
[arrowhead=normal arrowtail=normal];                                    
Municipio ->
UnidadeFederativa     [label="uf"] ;                            
MembroMesaDiretora ->
Parlamentar     [label="parlamentar"] ;               MembroMesaDiretora -> 
Cargo   
 [label="cargo"] ;               MembroMesaDiretora -> MesaDiretora    
[label="mesa_diretora"] ;                               Coligacao -> 
Legislatura    
[label="legislatura"] ;                               SessaoLegislativa ->
Legislatura     [label="legislatura"] ;                       MesaDiretora ->
Legislatura     [label="legislatura"] ;                                   
Parlamentar -> Partido     [label="partido"] ;               Parlamentar ->
CasaLegislativa     [label="casa_legislativa"] ;               Parlamentar ->
Municipio     [label="cidade"] ;               Parlamentar -> Telefone    
[label="telefones"] [style="dotted"] [arrowhead=normal arrowtail=normal]; 
                          Telefone -> ContentType     [label="content_type"] ;      
    }'
}}}

Thanks!

Original comment by semente@riseup.net on 28 May 2008 at 3:28

GoogleCodeExporter commented 8 years ago
Thanks semente for the full traceback !

Problem is that some distro's ship with an older version of pygraphviz then 
Debian
does, this older version only supports file inputs. Thus I've written a 
workaround
using a temporary file for these older versions.

This is fixed in revision 46.

Thanks for the report :)

Original comment by v.oostv...@gmail.com on 28 May 2008 at 4:35