Import missing module - airflow

What is the convention for properly importing a module in Airflow?
I would like to import this operator:
https://github.com/apache/airflow/blob/master/airflow/contrib/operators/mlengine_operator.py
using this line:
from airflow.contrib.operators import MLEngineTrainingOperator
I get the following error: `
cannot import name MLEngineTrainingOperator
`

This solved the issue.
from airflow.contrib.operators.mlengine_operator import MLEngineTrainingOperator

Related

How to import numjs (or any generic js library) in a vue 3 project?

Consider you do npm i numjs then you want to do something like
import * as nj from 'numjs'
but it does not quite work like other libraries. Is this the correct import statement or is there some trick?

Why am I unable to import #rainbow-me/rainbowkit/styles.css?

I am trying to integrate rainbowkit and wagmi into an existing website that currently uses web3. It works when I comment out the styles import but it just looks really ugly. I have made sure npm is latest version and so are rainbowkit and wagmi.
My import statement:
import '#rainbow-me/rainbowkit/styles.css'
result:
Failed to compile.
./src/App.tsx
Module not found: Can't resolve '#rainbow-me/rainbowkit/styles.css' in '/home/apollo/manifest-github/physical-claim-frontend/src'
I was having this issue as well.
I replaced the import with
import '#rainbow-me/rainbowkit/dist/index.css';
which is the non aliased path
seems to be compiling fine now!
I fixed it by replacing import '#rainbow-me/rainbowkit/styles.css' to import '#rainbow-me/rainbowkit/dist/index.css';

from import from python in reticulate

Any way to do the from - import from Python in Reticulate without having to import the whole module?
example: from tensorflow import keras
I know about the solution below, but it imports the whole module anyway...
keras <- import('tensorflow')$keras
I am not sure, but if you are writing your r code in an rmd file, wouldn't you be able to do it directly in a python chunk like this:
python
from ... import ...

Jupyter Notebook cell - Repeat same imports?

I have multiple Notebook cells where im importing the same libraries.
Is there a way to import these libraries once (like in the very 1st cell) and allow all other cells to use them?
Since my notebook has several cells, each importing the same libraries, i'm starting to see alot of redundancies.
Of course! You can add all your libraries at the very top of your notebook. All of them will be available for use.
import pandas as pd
import numpy as np
import matolotlib.pyplot as plt
import seaborn as sns

Sikuli - NameError: global name 'openApp' is not defined

I'm calling a sikuli function, inside Sikuli IDE, but I get this error "NameError: global name 'openApp' is not defined"...
If I try to do openApp('calc') in a new Sikuli blank file, it works, but if I use in another .sikuli file like:
def sample():
import myLib
# my Lib is .py file that I've created and put it on sikuli-script.jar
var = somevalue
myLib.myFunction(something)
openApp('calc')
I get the error with "openApp" and other sikuli funcions like "Key" (ex: Key.ENTER) too...
Hope I had explained that well
By default, Sikuli will insert a from sikuli import * into all main files. This error tends to occur when you import sikuli modules. If you are importing modules, you will need to add the import manually. See the documentation for more advice.
If your tests are in the same folder basically you can do,
import testName
reload(testName)
from testName import *
This will import your test and execute it's content.
testName should be name of the file without .sikuli extension
I ran into a similar problem was solved by putting from sikuli import * at the first line of any file you are importing. I hope this helps!
I only mentioned this, because with the imported files, I had the greatest overall success with this one, and it became habit to make this the first line.

Resources