Error in importing "from watson_developer_cloud import ToneAnalyzerV3", and "ibm_watson" in Visual Studio Code.
Python using VS code to run the Tone Analyzer in IBM Watson cloud. I tried the existing code, however some errors occur while compiling the code, as import packaging error happen. Even the tensorflow already updated and the specific packages already installed.
The bold fonts are the errors.
from __future__ import print_function
import json
from os.path import join, dirname
**from ibm_watson import ToneAnalyzerV3
from ibm_watson.tone_analyzer_v3 import ToneInput**
import operator
import twitter
import os
import json
**from watson_developer_cloud import ToneAnalyzerV3**
from _codecs import encode
I expect there is no wrong once compiled.
Related
Below code works — trying to import jquery file from node modules
Import $ from ‘jquery’;
Below code doesn’t work— I am trying to import the same jquery file from ‘clientapp/src/kendo’ folder
Import $ from ‘../kendo/jquery’;
Can you please suggest how to fix. Actually I have few licensed js library files, it errors when I try to import them from ‘clientapp/src/kendo’ folder.
You can use resolve.alias in webpack to import the modules from a directory that has more levels up in the filesystem.
https://webpack.js.org/configuration/resolve/#resolvealias
As a good practise, you should not import files from node_modules, those are compiled in webpack, so you use the import import $ from 'jquery'
I have a problem with firestore. I want to read some data from firebase but I can't import collection from firebase Attempted import error: 'collection' is not exported from 'firebase/firestore/'. I read some articles that said this problem is related to v9 SDK.
You have to import the Firebase SDKs correctly. The issue is in the first line where you are importing from "firebase" directly which is not the ideal method and as per my understanding, the import calls/methods are not in sync with the version changes. Be sure to read the documentation on using Firebase with module bundlers
Starting with Firebase v8.0.0, you have to import Firebase SDKs as per the documentation where it is mentioned that there was a breaking change in version 8.0 where
browser fields in package.json files now point to ESM bundles instead
of CJS bundles. Users who are using ESM imports must now use the
default import instead of a namespace import
Before 8.0.0
import * as firebase from 'firebase/app'
After 8.0.0
import firebase from 'firebase/app'
Code that uses require('firebase/app') or require('firebase') will still work, but you should change these require calls to require('firebase/app').default or require('firebase').default
Change your code as shown below :
import firebase from "firebase/app"
import { getFirestore } from "firebase/firestore";
import { collection, addDoc, getDocs } from "firebase/firestore";
import "firebase/auth"
const auth = firebase.auth()
This should work for you. If not, then probably you have updated your SDK version from 8 to 9 and with version 9 things changed a bit for importing firebase, but there is no need to downgrade to a previous version, there is a "compatibility" option so can use the /compat folder in your imports, like this
import firebase from 'firebase/compat/app';
From the Firebase documentation:
In order to keep your code functioning after updating your dependency
from v8 to v9 beta, change your import statements to use the "compat"
version of each import as shown below (v9 compat packages are API
compatible with v8 code) :
import firebase from 'firebase/compat/app';
import 'firebase/compat/auth';
import 'firebase/compat/firestore';
That error message means there is no such export "collection" from the module "firebase/firestore/". So the error is on the second line when you are trying to import "collection".
In the docs there is no trailing "/" in "firebase/firestore". Try removing that trailing "/" and try again.
I suggest you follow this guide on setting up firestore
I am using a create-react-app scaffoldin tool, and I want to upload and track some components into bit.dev.
the problem comes when I try to follow the following tutorial:
https://docs.bit.dev/docs/tutorials/bit-react-tutorial
When I try to import the React compiler, and I run this
bit import bit.envs/compilers/react --override
The process hangs forever with this statement:
/ ensuring package dependencies
Since I can not compile locally I recieve compile errors remotely on bit.dev ... any ideas why it is not importing the react compiler?
this is because you tried to import the compiler with the wrong flag.
To import a compiler, you need to run bit import like this:
bit import bit.envs/compilers/react --compiler
You can see all the optional flags here:
https://docs.bit.dev/docs/apis/cli-all#import
or running bit import -h.
How to fix this error in Expo v34.0.0?
In Expo, you can no longer import directly from 'expo', so change from (the old way):
import { Constants } from 'expo'; // OLD WAY
to (the updated way):
import Constants from 'expo-constants'; // NEW WAY
Similarly, if you are using the following features, use this format:
import MapView from 'react-native-maps';
import * as Location from 'expo-location';
import * as Permissions from 'expo-permissions';
import { DeviceMotion } from 'expo-sensors';
Expo documentation is quite helpful.
If you are using the online Expo editor, you will be prompted to install the packages, so just click OK. Otherwise, run:
expo install expo-constants
Expo separated a lot of their previously joined libraries and Constants is one of them, to get the constants now, follow along:
Install expo-constants by running this on your project directory:
expo install expo-constants
import Constants where needed as follows
import Constants from 'expo-constants';
Retrieve statusBarHeight like this:
const barHeight = Constants.statusBarHeight;
More on the new documentations for Expo SDK 34 can be found here.
Hope this Helps!
For some reason I can import the style if it's within the project director:
import styles from '../../../styles/style
But once I try to import from an external stylesheet, using the following line of code:
import styles from 'https://.....js';
I receive the error "Requiring unknown module https://.....js. If you are sure the module is there, try restarting the packager."
Is there a different method to importing externally? Thanks!