Skip to content

can not load complete.zip parts library #7

@hgschmie

Description

@hgschmie

MacOS 10.15.7, python 3.8.6 (installed from homebrew)

pyldraw installed from git repo (git clone ... pip3 install . )

when running ldr2png:

❯ ldr2png --help
retrieve the complete.zip from ldraw.org ...
unzipping the complete.zip ...
mklist...
generate ldraw.library.colours...
generate ldraw.library.parts, this might take a long time...
section minifig|hats ... |################################| 36/36
section minifig|heads ... |################################| 339/339
section minifig|torsos ... |################################| 498/498
section minifig|legs ... |################################| 122/122
section minifig|arms ... |################################| 22/22
section minifig|hands ... |################################| 11/11
section minifig|accessories ... |################################| 894/894
section minifig| ... |################################| 141/141
section animal ... |################################| 251/251
section antenna ... |################################| 9/9
section arch ... |################################| 36/36
section arm ... |################################| 33/33
section ball ... |################################| 6/6
section sphere ... |################################| 16/16
section bar ... |################################| 68/68
section container ... |################################| 101/101
section baseplate ... |################################| 197/197
section electric ... |################################| 811/811
section electric| ... |################################| 1/1
section electric|~ ... |################################| 4/4
"""
__init__.py - Package file for the ldraw Python package.

Copyright (C) 2008 David Boddie <david@boddie.org.uk>

This file is part of the ldraw Python package.

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program.  If not, see <http://www.gnu.org/licenses/>.
"""
import hashlib
import imp
import os
import shutil
import sys
import zipfile
from distutils.dir_util import copy_tree
from urllib.request import urlretrieve

from mklist.generate import generate_parts_lst
from pkg_resources import get_distribution, DistributionNotFound

from ldraw.config import get_config, write_config
from ldraw.dirs import get_data_dir, get_config_dir, get_cache_dir
from ldraw.generation.colours import gen_colours
from ldraw.generation.parts import gen_parts
from ldraw.parts import Parts
from ldraw.utils import ensure_exists

try:
    __version__ = get_distribution(__name__).version
except DistributionNotFound:
    # package is not installed
    pass

LDRAW_URL = 'http://www.ldraw.org/library/updates/complete.zip'
LIBRARY_INIT = """\"\"\" the ldraw.library module, auto-generated \"\"\"
__all__ = [\'colours\']
"""


def load_lib_from(fullname, library_dir):
    """ load library from a dir """
    dot_split = fullname.split('.')
    dot_split.pop(0)
    lib_name = dot_split[-1]
    lib_dir = os.path.join(library_dir, *tuple(dot_split[:-1]))
    info = imp.find_module(lib_name, [lib_dir])
    library_module = imp.load_module(lib_name, *info)
    return library_module


def load_lib(library_path, fullname):
    """ try to load from library """
    return load_lib_from(fullname, library_path)


"""
__init__.py - Package file for the ldraw Python package.

Copyright (C) 2008 David Boddie <david@boddie.org.uk>

This file is part of the ldraw Python package.

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program.  If not, see <http://www.gnu.org/licenses/>.
"""
import hashlib
import imp
import os
import shutil
import sys
import zipfile
from distutils.dir_util import copy_tree
from urllib.request import urlretrieve

from mklist.generate import generate_parts_lst
from pkg_resources import get_distribution, DistributionNotFound

from ldraw.config import get_config, write_config
from ldraw.dirs import get_data_dir, get_config_dir, get_cache_dir
from ldraw.generation.colours import gen_colours
from ldraw.generation.parts import gen_parts
from ldraw.parts import Parts
from ldraw.utils import ensure_exists

try:
    __version__ = get_distribution(__name__).version
except DistributionNotFound:
    # package is not installed
    pass

LDRAW_URL = 'http://www.ldraw.org/library/updates/complete.zip'
LIBRARY_INIT = """\"\"\" the ldraw.library module, auto-generated \"\"\"
__all__ = [\'colours\']
"""


def load_lib_from(fullname, library_dir):
    """ load library from a dir """
    dot_split = fullname.split('.')
    dot_split.pop(0)
    lib_name = dot_split[-1]
    lib_dir = os.path.join(library_dir, *tuple(dot_split[:-1]))
    info = imp.find_module(lib_name, [lib_dir])
    library_module = imp.load_module(lib_name, *info)
    return library_module


def load_lib(library_path, fullname):
    """ try to load from library """
    return load_lib_from(fullname, library_path)


def try_download_generate_lib():
    # Download the library and generate it, if needed
    config = get_config()
    parts_lst_path = config['parts.lst']
"""
__init__.py - Package file for the ldraw Python package.

Copyright (C) 2008 David Boddie <david@boddie.org.uk>

This file is part of the ldraw Python package.

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program.  If not, see <http://www.gnu.org/licenses/>.
"""
import hashlib
import imp
import os
import shutil
import sys
import zipfile
from distutils.dir_util import copy_tree
from urllib.request import urlretrieve

section belville ... |################################| 10/10
section bigfig ... |################################| 8/8
section figure ... |################################| 657/657
"""
__init__.py - Package file for the ldraw Python package.

Copyright (C) 2008 David Boddie <david@boddie.org.uk>

This file is part of the ldraw Python package.

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program.  If not, see <http://www.gnu.org/licenses/>.
"""
import hashlib
import imp
import os
import shutil
import sys
import zipfile
from distutils.dir_util import copy_tree
from urllib.request import urlretrieve

from mklist.generate import generate_parts_lst
from pkg_resources import get_distribution, DistributionNotFound

from ldraw.config import get_config, write_config
from ldraw.dirs import get_data_dir, get_config_dir, get_cache_dir
from ldraw.generation.colours import gen_colours
from ldraw.generation.parts import gen_parts
from ldraw.parts import Parts
from ldraw.utils import ensure_exists

try:
    __version__ = get_distribution(__name__).version
except DistributionNotFound:
    # package is not installed
    pass

LDRAW_URL = 'http://www.ldraw.org/library/updates/complete.zip'
LIBRARY_INIT = """\"\"\" the ldraw.library module, auto-generated \"\"\"
__all__ = [\'colours\']
"""


def load_lib_from(fullname, library_dir):
    """ load library from a dir """
    dot_split = fullname.split('.')
    dot_split.pop(0)
    lib_name = dot_split[-1]
    lib_dir = os.path.join(library_dir, *tuple(dot_split[:-1]))
    info = imp.find_module(lib_name, [lib_dir])
    library_module = imp.load_module(lib_name, *info)
    return library_module


def load_lib(library_path, fullname):
    """ try to load from library """
    return load_lib_from(fullname, library_path)


def try_download_generate_lib():
    # Download the library and generate it, if needed
    config = get_config()
section bike ... |################################| 34/34
section vehicle ... |################################| 158/158
section constraction ... |################################| 45/45
section boat ... |################################| 103/103
section bracelet ... |################################| 7/7
section bracket ... |################################| 37/37
section brick ... |################################| 954/954
section magnet ... |################################| 16/16
section bucket ... |################################| 10/10
section || ... |################################| 1/1
generate ldraw.library.colours...
generate ldraw.library.parts, this might take a long time...
section minifig|hats ... |################################| 36/36
section minifig|heads ... |################################| 339/339
section minifig|torsos ... |################################| 498/498
section minifig|legs ... |################################| 122/122
section minifig|arms ... |################################| 22/22
section minifig|hands ... |################################| 11/11
section minifig|accessories ... |################################| 894/894
section minifig| ... |################################| 141/141
section animal ... |################################| 251/251
section antenna ... |################################| 9/9
section arch ... |################################| 36/36
section arm ... |################################| 33/33
section ball ... |################################| 6/6
section sphere ... |################################| 16/16
section bar ... |################################| 68/68
section container ... |################################| 101/101
section baseplate ... |################################| 197/197
section electric ... |################################| 811/811
section electric| ... |################################| 1/1
section electric|~ ... |################################| 4/4
section belville ... |################################| 10/10
section bigfig ... |################################| 8/8
section figure ... |################################| 657/657
section bike ... |################################| 34/34
section vehicle ... |################################| 158/158
section constraction ... |################################| 45/45
section boat ... |################################| 103/103
section bracelet ... |################################| 7/7
section bracket ... |################################| 37/37
section brick ... |################################| 954/954
section magnet ... |################################| 16/16
section bucket ... |################################| 10/10
section || ... |################################| 1/1
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/site-packages/ldraw/__init__.py", line 84, in try_download_generate_lib
    generate(parts_lst_path, ldraw_path)
  File "/usr/local/lib/python3.8/site-packages/ldraw/__init__.py", line 180, in generate
    gen_parts(parts, output_dir)
  File "/usr/local/lib/python3.8/site-packages/ldraw/generation/parts.py", line 73, in gen_parts
    generate_section(parts, parts_dir, section_name, section_parts)
  File "/usr/local/lib/python3.8/site-packages/ldraw/generation/parts.py", line 120, in generate_section
    write_section_file(parts_dir, parts_list, module_path(section_name))
  File "/usr/local/lib/python3.8/site-packages/ldraw/generation/parts.py", line 33, in write_section_file
    with codecs.open(parts_py, 'w', encoding='utf-8') as generated_file:
  File "/usr/local/Cellar/python@3.8/3.8.6/Frameworks/Python.framework/Versions/3.8/lib/python3.8/codecs.py", line 905, in open
    file = builtins.open(filename, mode, buffering)
OSError: [Errno 30] Read-only file system: '//.py'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/bin/ldr2png", line 5, in <module>
    from ldraw.tools.ldr2png import main
  File "/usr/local/lib/python3.8/site-packages/ldraw/tools/ldr2png.py", line 29, in <module>
    from ldraw.writers.png import PNGWriter, PNGArgs
  File "/usr/local/lib/python3.8/site-packages/ldraw/writers/png.py", line 27, in <module>
    from ldraw.writers.common import Writer
  File "/usr/local/lib/python3.8/site-packages/ldraw/writers/common.py", line 7, in <module>
    from ldraw.library.colours import White, Main_Colour
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 655, in _load_unlocked
  File "<frozen importlib._bootstrap>", line 618, in _load_backward_compatible
  File "/usr/local/lib/python3.8/site-packages/ldraw/__init__.py", line 152, in load_module
    generated_library_path = try_download_generate_lib()
  File "/usr/local/lib/python3.8/site-packages/ldraw/__init__.py", line 88, in try_download_generate_lib
    generate(parts_lst_path, data_dir)
  File "/usr/local/lib/python3.8/site-packages/ldraw/__init__.py", line 180, in generate
    gen_parts(parts, output_dir)
  File "/usr/local/lib/python3.8/site-packages/ldraw/generation/parts.py", line 73, in gen_parts
    generate_section(parts, parts_dir, section_name, section_parts)
  File "/usr/local/lib/python3.8/site-packages/ldraw/generation/parts.py", line 120, in generate_section
    write_section_file(parts_dir, parts_list, module_path(section_name))
  File "/usr/local/lib/python3.8/site-packages/ldraw/generation/parts.py", line 33, in write_section_file
    with codecs.open(parts_py, 'w', encoding='utf-8') as generated_file:
  File "/usr/local/Cellar/python@3.8/3.8.6/Frameworks/Python.framework/Versions/3.8/lib/python3.8/codecs.py", line 905, in open
    file = builtins.open(filename, mode, buffering)
OSError: [Errno 30] Read-only file system: '//.py'

and stuck. Any ideas?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions