mirror of
https://github.com/simonw/datasette.git
synced 2025-12-10 16:51:24 +01:00
imp. is deprecated, use types.ModuleType instead
Thanks https://stackoverflow.com/a/32175781
This commit is contained in:
parent
dd67c491f3
commit
dc893692fb
1 changed files with 2 additions and 2 deletions
|
|
@ -3,7 +3,6 @@ from collections import OrderedDict
|
|||
import base64
|
||||
import click
|
||||
import hashlib
|
||||
import imp
|
||||
import json
|
||||
import os
|
||||
import pkg_resources
|
||||
|
|
@ -11,6 +10,7 @@ import re
|
|||
import shlex
|
||||
import tempfile
|
||||
import time
|
||||
import types
|
||||
import shutil
|
||||
import urllib
|
||||
import numbers
|
||||
|
|
@ -588,7 +588,7 @@ def link_or_copy_directory(src, dst):
|
|||
|
||||
def module_from_path(path, name):
|
||||
# Adapted from http://sayspy.blogspot.com/2011/07/how-to-import-module-from-just-file.html
|
||||
mod = imp.new_module(name)
|
||||
mod = types.ModuleType(name)
|
||||
mod.__file__ = path
|
||||
with open(path, "r") as file:
|
||||
code = compile(file.read(), path, "exec", dont_inherit=True)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue