import

Webpack fails silently when named import doesn't exist

时间秒杀一切 提交于 2021-02-07 18:32:34
问题 When I try to import a named import, it fails silently if the name import does not exist. Is there a way to get webpack to fail loudly when it cannot find the import at build time For example: // file1.js const var1 = 'var1' export { var1 } and // file2.js import { var2 } from './file1' // at this point, var2 is undefined at runtime because it was never exported from file1.js Instead, I want it to fail at build time. Is there a webpack option or some other technique I can use to catch this

How to import a module but ignoring the package's __init__.py?

时间秒杀一切 提交于 2021-02-07 14:18:57
问题 I'm trying to import a function which is in a module inside a package in Python, but when I try: from package.module import some_function Python executes the package's _ init _.py but it can't happen. Is there a way to import the function telling Python to ignore the package's _ init _.py? 回答1: The answer is No, you can't import a python package without the __init__.py being executed. By definition, to make a package, you must put in that directory a __init__.py. But, you can make an empty _

Java referencing a class in the same directory

旧时模样 提交于 2021-02-07 11:42:30
问题 I created a Pair class in Java (similar to the c++ pair) and am having trouble referencing it from a different java file. I am working inside a Java file, let's call it fileA in the same directory as Pair.class. Additionally, I have written package current-directory at the top of both files. However, when I try javac fileA all my errors are cannot find symbol and the little arrow points to my custom Pair type. How do I get the java compiler to see Pair.class inside of fileA ? Thanks for all

Importing multiple files into a single, merged data frame in R

爷,独闯天下 提交于 2021-02-07 09:38:53
问题 I have 8 CSV files all in the same directory, and need them importing into a single data frame in R. They all follow the same naming convention, "dataUK_1.csv", "dataUK_2.csv" etc., and have the exact same structure in terms of columns. I've managed to create a vector of all the file names (including the full directory) by using: files = list.files("/Users/iarwain/Data", pattern=".csv", full.names=T) I'm just not sure how to pass these names to the read.csv command so that it loops 8 times,

python 3.x C extension module and submodule

谁都会走 提交于 2021-02-07 04:20:19
问题 How do I make a C extension for python 3.x when a module has sub-modules? For example, I have a file called pet.c: #include <Python.h> PyObject* CatMeow(PyObject* self) { return PyUnicode_FromString( ">*<" ); } static PyMethodDef CatFunctions[] = { {(char*) "meow", (PyCFunction) CatMeow, METH_NOARGS, NULL}, {NULL, NULL, 0, NULL} }; static PyModuleDef CatDef = { PyModuleDef_HEAD_INIT, "cat", "cat ext", -1, CatFunctions, NULL, NULL, NULL, NULL }; PyMODINIT_FUNC PyInit_cat(void) { return

pylint not recognizing some of the standard library

为君一笑 提交于 2021-02-06 15:15:52
问题 I'm using pylint + pydev, with python 2.6. I have a module with just this line of code from email import Message Now when I try to run this module it runs fine. But pylint reports an error: ID: E0611 No name 'Message' in module 'email' Although it exists... Any idea why? 回答1: I like pylint, but I do find I have to use a lot of # pylint: disable-msg=E0611 and the like to make it shut up in cases that are perfectly correct but confuse it (for example, like in this case, due to email 's playing

How to import 3D scene (.obj file with .mtl file)

岁酱吖の 提交于 2021-02-06 11:24:39
问题 I bought a 3D Model of a room. The model is in the .obj format. Now, I'm trying to import this model into Unity3D. The Model came with: 5 x .obj files 5 x .mtl files n x .jpg files n x .tga files The .mtl files contained paths that do not exist on my PC. So I removed the paths. The images files ( .jpg & .mtl ) are in the same directory as the .obj files. When I tried to import the .obj files, the room has no material on it. I then tried to use the FBX converter (with "Embed media" checked) to

How to import dump folder into mongodb database?

雨燕双飞 提交于 2021-02-06 09:56:05
问题 I have created a mongo dump from a remote server and .bson and .metadata files stored in to a folder. I want to import this folder into my local mongodb . I am using robomongo as a mongodb client ui . I got some command which are importing json files one by one but I want import all the files at a time by robomongo or cmd. 回答1: mongodump is a util for creating a binary export of the database. mongodump is used in conjunction with mongorestore as a backup strategy. If you wanted to restore

Python NameError when using an imported function

我的未来我决定 提交于 2021-02-05 11:51:35
问题 When I import and use a function in a python(2.6.5) program, I get an error: from Localization import MSGR title = Localization.MSGR("Logfile from Ctf2Rrl.") NameError: global name 'Localization' is not defined Could you please explain why? Regards, 回答1: If you import your method like this, you can user MSGR but not Localization.MSGR :) If you want to use Localization.MSGR , you can just import Localization 回答2: The import statement of the form: from foo import bar Doesn't introduce the

Python NameError when using an imported function

。_饼干妹妹 提交于 2021-02-05 11:50:56
问题 When I import and use a function in a python(2.6.5) program, I get an error: from Localization import MSGR title = Localization.MSGR("Logfile from Ctf2Rrl.") NameError: global name 'Localization' is not defined Could you please explain why? Regards, 回答1: If you import your method like this, you can user MSGR but not Localization.MSGR :) If you want to use Localization.MSGR , you can just import Localization 回答2: The import statement of the form: from foo import bar Doesn't introduce the