Giter Club home page Giter Club logo

Comments (3)

hcarter333 avatar hcarter333 commented on July 19, 2024

The issue is still present, and the fix above still works in datasette version 1.0a3

from datasette.

hcarter333 avatar hcarter333 commented on July 19, 2024

Looking into coming up with a fix instead of a patch, (see above.)
When I run with the released code, but add a print statement to see what the value of [extension] is I get back:
['/usr/lib/x86_64-linux-gnu/mod_spatialite.so']

Which matches the input argurment to the datasette command:

c

but I'm on a Windows box, so let's go wtih:

python3 -m datasette rm_toucans.db --metadata qso_loc.yml --load-extension=C:\Windows\System32\mod_spatialite.dll --plugins-dir=plugins --template-dir plugins/templates --root

That resulted in no output whatsoever. I'm going to try wrapping the path in double quotes since I'm on Windows.

Nope, still no output. Let's try a Linux style path with double quotes.

With a Linux style path, I get the same error.
I get the same error without the double quotes.

Here's part of the issue:
`# The --load-extension parameter can optionally include a specific entrypoint.

This is done by appending ":entrypoint_name" after supplying the path to the extension

class LoadExtension(click.ParamType):
name = "path:entrypoint?"
def convert(self, value, param, ctx):
print("loadex " + value)
if ":" not in value:
return value
path, entrypoint = value.split(":", 1)
return path, entrypoint
`

Notice the dependency on ':' in that block of code from /utils/Init.py.
Since Windows paths have 'C:' routinely, that's an issue.

No fix yet.

from datasette.

hcarter333 avatar hcarter333 commented on July 19, 2024

And here's the proposed fix. I still need to for and do a pull request and all that good stuff, but the fix in /utils/init.py should be:

The following in the LoadExtension class:

        #:\ indicates we're on a Windows machine study the argument a bit more
        if ":\\" in r"%r" % value:
            path_entry = value.split(":", 2)
            if len(path_entry) < 3:
                return value
            #argument contains a Windows/DOS path and an entry point
            path = path_entry[0] + ":" + path_entry[1]
            entrypoint = path_entry[-1]
            return path, entrypoint
        if ":" not in value:
            return value
        path, entrypoint = value.split(":", 1)
        return path, entrypoint

To make things even spiffier, add the (somewhat standard?) landing path for the spatialite dll on Windows:

ala

SPATIALITE_PATHS = (
    "/usr/lib/x86_64-linux-gnu/mod_spatialite.so",
    "/usr/local/lib/mod_spatialite.dylib",
    "/usr/local/lib/mod_spatialite.so",
    "/opt/homebrew/lib/mod_spatialite.dylib",
    "C:\Windows\System32\mod_spatialite.dll",
)

from datasette.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.