Git Product home page Git Product logo

Comments (5)

coleifer avatar coleifer commented on June 18, 2024

In #3 I reported that everything was working fine for me. Now I'm getting a setfault every time I try to run register().

What has changed? What's different between then and now? I would expect any such problem to be deterministic. In other words, I would expect something important must have changed between when you had it working and now.

from sqlite-vtfunc.

coleifer avatar coleifer commented on June 18, 2024

From the stack-trace it looks like sqlite3_create_module() is getting passed a null pointer, but I'm not clear what might be causing that.

from sqlite-vtfunc.

simonw avatar simonw commented on June 18, 2024

This is the thing that baffles me: I'm reasonably sure I'm running the exact same sequence of commands that I described in #2 and #3 but I'm now getting a different result. I don't think I've upgraded my system Python or anything like that. It's really weird.

I notice that in #2 (comment) I installed the module and checked that it could be imported but did not attempt to use it. But I'm certain I saw the scraper example work with 0.3.3 yesterday (though I don't think I recorded a full Python shell transcript). And now I can't get it to work at all.

At least this time I've been able to get a stacktrace out of it. I wish I could answer your question about "what has changed" - because obviously something has, but I'm at a loss for what it is.

from sqlite-vtfunc.

simonw avatar simonw commented on June 18, 2024

Here's my current full steps-to-reproduce:

$ python3 -mvenv vtfunc-0-3-3
$ source vtfunc-0-3-3/bin/activate
$ pip install vtfunc
$ pip install requests
$ python

import re, sqlite3
from vtfunc import TableFunction

class Scraper(TableFunction):
    params = ['url']  # Function argument names.
    columns = ['href', 'description']  # Result rows have these columns.
    name = 'scraper'  # Name we use to invoke the function from SQL.
    def initialize(self, url):
        # Note that this is bytes:
        self.html = requests.get(url).content
        self._iter = re.finditer(
            '<a[^\>]+?href="([^\"]+?)"[^\>]*?>([^\<]+?)</a>',
            self.html)
    def iterate(self, idx):
        return next(self._iter).groups()

conn = sqlite3.connect(':memory:')
Scraper.register(conn)

This dies with Segmentation fault: 11

from sqlite-vtfunc.

simonw avatar simonw commented on June 18, 2024

Huh... I appear to have fixed it! I used the above steps but I swapped out pip install vtfunc for this:

pip install --no-cache-dir vtfunc

The above example no longer segfaults.

from sqlite-vtfunc.

Related Issues (12)

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.