What is the difference between import statements with aliases and sub-paths?
For example, I usually write
import RNFirebase from "react-native-firebase"
but sometimes, I have seen lines such as
import functions from "#react-native-firebase/functions"
Thanks.
import RNFirebase from "react-native-firebase"
is import library RNFirebase.
And
import functions from "#react-native-firebase/functions"
is import modules functions of library RNFirebase.
More in 'Specific module installation' here.
Hope help you.
Related
With the revitpythonshell 2020 I try to import the class ExporterIFCUtils
from Autodesk.Revit.DB.IFC import ExporterIFCUtils
and get the error:
"Exception : IronPython.Runtime.Exceptions.ImportException: Cannot import name ExporterIFCUtils"
#StefanAnd you'll need to add a reference to the RevitAPIIFC.dll first:
>>> clr.AddReference("RevitAPIIFC")
>>> from Autodesk.Revit.DB.IFC import ExporterIFC
>>> ExporterIFC
<type 'ExporterIFC'>
>>>
It's a bit weird, since it looks like you're importing from a module, but it's a .NET "namespace". These can span multiple assemblies as in the case here, so first referencing the RevitAPIIFC.dll will populate the namespace with the types you expect. Sadly, the Revit API documentation doesn't actually seem to provide the assembly names. At least, I couldn't find them...
Suppose I have one sass file named common.scss, suppose there are another 2 sass files, each named chat.scss and thread.scss, each of the 2 sass file import common.scss in the begining, like
#import 'common'
......
other self class definition codes
......
The case is, in build out production files phase, sometimes I only need to import chat.scss, but sometimes I need to import both chat.scss and thread.scss. When import both scss files, as you can see there will be extra class definition as each of them import common.scss. So I want to know is there any webpack plugin can remove extra class definition in build phase ?
models. *
classes. *
How do not import some files of the directories? And import them only when we need?
For example: I need import file models/SomeModel.php only in controller SomeController.php. I need import file classes/SomeClass.php only in controller SomeController.php and Some2Controller.php.
use when needed:
Yii::import('application.models.SomeModel');// protected/models/SomeModel.php
Yii::import('application.classes.SomeClass');// protected/classes/SomeClass.php
But beware that import() is different than require or include, import relies on Class names being the same as file names.
Forgive a noob. This may be beyond me.
I currently import variables from a module via
from a import *
What I aim to do is import the file as per the input string.
mod=str(input("Select a module: "))
from str(mod) import *
This is what I tried. Clearly wrong. I would like the code to ask for an input, which would be the name of a specific module, then import what the user inputs.
Sorry I can provide any more code, the nature of the question prevents me from being capable of showing what I need
You can simply use __import__():
>>> d = __import__("datetime")
>>> d
<module 'datetime' from 'C:\\Python33\\lib\\datetime.py'>
For a more sophisticated importing I suggest using importlib.
EDIT1 to make it more clear:
>>> mymodule = __import__(input("Which module you want?" ))
>>> mymodule.var1
If you want var1 instead of mymodule.var1, I would make aliases to the global namespace. However, I wouldn't do that since I do not see any sense in that.
I have a CSV file which contains these columns - Timestamp, Author, Title and Content.
Now I would like to import this CSV into TYPO3, so that I can display a list of posts containing these attributes.
If the above is not possible, is there a way to write in manual SQL queries, so that I can manually insert content into TYPO3 ?
I have tried many extensions for importing CSV- wil_import, rs_impory, external import .. but none of them work !!
In the following image, I have installed wil_import, but It does not show up anything.
Do I need to make any changes anywhere else, like configuration or something?
You could use phpmyadmin's CSV import functionality. It works reliably.
I've had same problem once and my day was saved thanks to Francois Suter's (Core team member) extensions: svconnector and svconnector_csv. So, I can really recommend them