Questions tagged [import]

0

votes
0

answer
10

Views

In PYCHARM imports work fine but give me an error while running the module from CLI

I am newbie to programming. I am importing a function from a.py to b.py (i.e from pkg.subpkg1.a import func) but it give me an error (ModuleNotFoundError: No module named 'pkg') directory structure: root-dir /pkg /subpkg1 a.py /subpkg2 b.py
Abdullah
1

votes
2

answer
340

Views

UPS Tracking On Google Sheet does not work

I used following formula get UPS live tracking feed and it works fine until yesterday. I think UPS has updated their site and this formula does not work anymore. Any idea or suggestions for how to get the tracking update from UPS? =Index(IMPORTXML('https://wwwapps.ups.com/WebTracking/track?track=ye...
PrasadD
1

votes
1

answer
42

Views

IMP in oracle 12c does not create tables with IDENTITY feature

I exported an schema which has approximately 150 tables using EXP. Almost all of the tables in the schema have an IDENTITY column. When I imported the .dmp file using IMP on different server it created all the table and imported the data but IDENTITY is removed. Any suggestion?
Rajesh Ranjan
1

votes
1

answer
22

Views

Ensuring the absence of an __init__ function in Python

I'm writing a plugin-based application. Part of the specification for a plugin is that a plugin must not implement the __init__ method, as any initialization needs to be handled by the plugin manager, not the plugin itself. (A plugin writer would define their startup code in another method, called b...
Mikey T.K.
-1

votes
1

answer
37

Views

Python import class

In a folder with an empty __init__.py file I have a class Memory and a class Worker. For some reason, I cannot do import Memory nor with the filename import memory and variants don't work, just trying to instantiate wont work either. mem = Memory() gives an error. How do I do proper import?
1

votes
0

answer
5

Views

Is it possible to load a pre-trained model into spacy?

I want to be able to use spacy's full functionality, but my language of choice does not currently have it's own model on spacy. By full functionality, I mean convolutional layer that is shared between the tagger, parser and NER; and be able to update all of these different models by extending the v...
user2827262
1

votes
1

answer
4k

Views

Python cannot import name if placed in module [duplicate]

Possible Duplicate: How to do relative imports in Python? I'm experiencing something that seems very random to me. I have a folder structure much like this: dir A __init__.py is empty a.py imports stuff and b.py dir B __init__.py is empty b.py imports NOTHING a.py raises an error (cannot import nam...
A.J.Rouvoet
1

votes
2

answer
480

Views

Python Kivy: unable to import main main

While reading the book, Creating Kivy apps with Python, it says to 'Next, update the imports in weather.kv to import this main module instead of the ListItemButton class; see Example 3-7. Example 3-7. Importing a custom class from main #: import main main #: import ListAdapter kivy.adapters.listadap...
John Doe
0

votes
0

answer
3

Views

Node: How Can I Import Web3 To Node.js?

I'm trying to import the web3 library in Node.js so that I can handle Ethereum smart contract events, however I can't get the import to work. I'm running Babel on each file to convert to es5, and the import in Node's index.js file looks like this: import Web3 from web3; When I add that 'import Web3...
Steve
1

votes
3

answer
748

Views

Importing dynamically all modules from a folder

I know there is this question, but not only they're not working, it's not exactly what I want. I'm developing a racing game and want to load all tracks from a folder dynamically (They're stored as .py instead of .json). I don't want to know the names of the tracks, since users can mod/add them at wi...
Ericson Willians
1

votes
1

answer
1k

Views

Lazy Loading Routes in React With Typescript AsyncComponent

I'm trying to lazy load routes in React by implementing the AsyncCompoment class as documented here Code Splitting in Create React App. Below is the es6 asyncComponent function from the tutorial: import React, { Component } from 'react'; export default function asyncComponent(importComponent) { clas...
Mike Lunn
1

votes
3

answer
266

Views

Move SQL Server Database data to SAP BW

I have read a few articles about moving data out of SAP BW and into SQL Server. I cant find any articles on moving the data from SQL Server to SAP BW, is it even possible and if so what would be the best way to handle this?
Etienne
1

votes
4

answer
39

Views

Add all objects from one file to a list in another file

I have the following python file constants.py which stores a bunch of constants: ONE = 1 TWO = 2 ANOTHER = 'Test' .... I'm trying to import all of the variables and add them to a list called data. This is what I have so far but if I add a constant to constants.py then I need to remember to add it to...
Johnny Metz
1

votes
1

answer
29

Views

Django cannot setup when not using manager

I am having a strange issue, hopefully someone has encountered it before. I have a custom script located at my_project/my_app/scripts/custom_script.py -- My desired use case is to feed this script a filepath and have it process the file and load/modify some data within my database. Here is a snippet...
wKavey
0

votes
1

answer
15

Views

Import failed - Uncaught ReferenceError: function is not defined

I have two JavaScript files, and I'm trying to import and use the first one in the second file. The code I'm trying to import is the following: let someFunction = function ( elem ) { // some function stuff }; And I'm trying to import it and use it in another file like this: import '../utilities/func...
birdybird03
1

votes
3

answer
13.4k

Views

How to export text data from a SQL Server table?

I am trying to use the MS SQL Server 2005 Import/Export tool to export a table so I can import it into another database for archival. One of the columns is text so if I export as comma-delimited, when I try to import it into the archive table, it doesn't work correctly for rows with commas in that f...
kenwarner
1

votes
4

answer
1.6k

Views

Python ImportError when executing 'import.py', but not when executing 'python import.py'

I am running Cygwin Python version 2.5.2. I have a three-line source file, called import.py: #!/usr/bin/python import xml.etree.ElementTree as ET print 'Success!' When I execute 'python import.py', it works: C:\Temp>python import.py Success! When I run the python interpreter and type the commands, i...
-2

votes
1

answer
14

Views

Trouble with imports

I have a folder containing my python project. I'm having trouble importing files I need to draw from ->big folder | |___________ | ->files to draw from | | | |_________x.py | | | |_________y.py | |___________ | -> main f...
Mark S
1

votes
2

answer
8.4k

Views

Function to import data from a txt file to a SQL-Server table

I am quite new with SQL Server. I have got a .txt file with values separated like this: 20120101;001;2;0;0;0;0;0;8 20120102;002;3;0;0;0;0;0;8 20120103;003;4;0;0;0;0;0;8 ... This file is in a server and I need to import this file everyday at the same hour autommaticaly, and update the changes (the fi...
andoni90
1

votes
1

answer
487

Views

create schema for imported csv in mongodb

i have a csv that looks like this: Number,Date,ClientName,ClientSurname,ClientAge,Option1,Option2 1,01/01/2015,John,Foo,24,30, using mongoimport i get { '_id':ObjectID(''), 'Number':1, 'date':'01/01/2015', 'ClientName':'John', 'ClientSurname':'Foo', 'ClientAge':24, 'Option1':30, 'Option2': '', } w...
doe
1

votes
1

answer
26

Views

Importing a file in python

I tried to import the file only using import I searched the problem and found out it happened because the file isn't in the same working directory as my current file, didn't quite understand that(I am a beginner). So I tried using this: But still I get this error No module named printer1. Here is t...
Programmingfreak
0

votes
0

answer
12

Views

How to set the ROOT for all PHP imports in a directory?

I have some web pages where I use php to import page elements. On each page, I set the root. Within the HTML, I import other code that I use such as libraries, the navigation bar, and the footer. Here is the code: Sets the root to import from: Imports all the css and javascript for the page: Imports...
JustBlossom
1

votes
1

answer
296

Views

Import CSV file with extension yii2-csv-importer

I'm not sure how to use the extension 'yii2-csv-importer'. I need to import a CSV file that is in the app/web/uploads/mod-key.csv directory My table/model (BASE) and csv file have the following structure: 'id' 'date' 'Pan 'key' 'goal' 'accomplished' 'Weight' 'points' 'update' How would my ACTION loo...
gugoan
1

votes
1

answer
975

Views

importing a shapefile to python with pyshp

I'm trying to import the shapefile 'Metropolin_31Jul_0921.shp' to python using the following code: import shapefile stat_area_df = shapefile.Reader('Metropolin_31Jul_0921.shp') but i keep getting this error: File 'C:\Users\maya\Anaconda3\lib\site-packages\shapefile.py', line 291, in load raise Shap...
מיה ארדיטי
1

votes
2

answer
222

Views

Merge CSV in neo4j avoiding duplicates

I am Working with neo4j and an example Data-set of Movies. https://neo4j.com/developer/example-data/ I now want to import and update my database with an CSV file of grouplens https://grouplens.org/datasets/movielens/ If the movie written in the csv-file is already in the database i want to update...
user9167430
1

votes
2

answer
75

Views

Not able to get all contacts due to too much work on main thread

I am trying to store all contacts in a String array, but it's not getting all contacts due to the following error: I/Choreographer: Skipped 213 frames! The application may be doing too much work on its main thread. Java Code private void getContactList() { ContentResolver cr = getContentResolver();...
Chintan Parmar
1

votes
0

answer
101

Views

Google Apps Script, import ics files

How can I import ics files by using google apps script? In my case i would like to import multiple ics files, from Gdrive or from local pc. Thanks in advance.
RHO
1

votes
0

answer
178

Views

Import of package works in IPython shell but not in Jupyter notebook

I think this question is probably closely related to another one I had, but I'm not sure what the best general-purpose answer is. On my laptop, if I log into the IPython shell, I can execute In [1]: import matplotlib without error. But if I try to do the same thing in a Jupyter notebook, I get the f...
dbliss
1

votes
0

answer
81

Views

Im trying to import a jsx file into another jsx file but im getting an syntax error

I'm learning ReactJS and I am trying to import a .jsx file . into another .jsx file. I have added this to import a file: import Users from './Users'; But I am getting a SyntaxError Unexpected identifier error, can anyone point me in the right direction?
Craig
1

votes
2

answer
60

Views

How to write a file then import it

I need to write some variables to a file then import it. Whenever I try to run it, though, the console says that the variable doesn't exist. file_writer.py: target = open('save.py', 'w') target.write('x = 2') from save import * print(x) save.py: x = 2 save.py was empty before running file_writer.py.
Card Wallets
1

votes
1

answer
509

Views

Webpack ag-grid-enterprise import

I try to use ag-grid-enterprise in my app (webpack build). I import thats way: import * as agGrid from 'ag-grid/dist/ag-grid.min'; import 'ag-grid-enterprise/main' The agGrid functionality is working, but the enterprise methods are not available. How can I solve it? Thanks
user3712353
1

votes
1

answer
56

Views

Importing a JSON file by using module declaration

In my Ionic2 project I imported a JSON file with this statement: import * as data from './data.json'; I also created the file typings.d.ts in the project's root directory with this contents: declare module '*.json' { const value: any; export default value; } As suggested here. But this does not work...
herhuf
1

votes
1

answer
100

Views

Importing ARCharts framework/project into Swift project

I have tried a myriad of ways to import the following Github project into my Swift iOS project so I can build upon ARCharts, but it did not work. I need to import it manually so I can adapt the graphs design afterwards. My Project: https://www.dropbox.com/sh/r0hwil6w5n4a1ie/AAC-O9nDX_6W3kK1nPwWjA3ca...
Sam
1

votes
1

answer
55

Views

python import error from setup.py if dependencies are not installed

In one my python package in setup.py is imported module __about__.py located inside package (where are stored all metadata and want to share it between pakcage and setup). setup.py also installing other dependent third-party library for my package. Also inside package in module __init__.py are impor...
vlk
1

votes
0

answer
140

Views

“ ch.setopt(ch.HTTPPOST, data.items()) TypeError: invalid arguments to setopt” i am getting this error

When I put all my authorization data into data = { 'token': 'XXXXXXXXXXXXXXXXXXXXXXXXXXX', 'content': 'file', 'action': 'import', 'record': '', 'field': 'record_id', 'event': '', 'returnFormat': 'csv', 'file': '(pycurl.FORM_FILE, file)' } I get error at h.setopt(ch.HTTPPOST, data.items()) which say...
Himanshu Vaishnav
1

votes
1

answer
56

Views

python - importing module from within a module

I have this file pluralizer.py containing functions and a class which use the re module: from re import * def pluralize(noun, funcs): for matches_rule, apply_rule in funcs: if matches_rule(noun): return apply_rule(noun) raise ValueError('no matching rule for {0}'.format(noun)) def build_match_and_a...
P. Prunesquallor
1

votes
1

answer
61

Views

Resolving NodeJS CSS subpackages?

I'm creating a CSS library and I'd like to support subpackages the same way RxJS does. For example with RxJS we can import the entire kitchen sink like this (Taken from https://www.npmjs.com/package/rxjs): var Rx = require('rxjs/Rx'); Rx.Observable.of(1,2,3); // etc Or individual operators like th...
Ole
1

votes
0

answer
264

Views

How to bundle a python script that imports zerorpc with pyinstaller?

I have the following script called api.py that I'd like to turn into a python app using pyinstaller. The below function works when I run it out of sublime text but when I try to convert it into an unix executable application using pyinstaller, the app does not work. Pyinstaller works only if I dont...
Chris
1

votes
1

answer
170

Views

Add java class to jython as jython import module

I am using jython interpreter programmatically (PythonInterpreter) in my java application, and I'd like to add a specific class, eg. MyJythonLib as a Jython import module so that my Jython script could have something like: import MyJythonLib a = MyJythonLib.getStuff() where MyJythonLib.java is publ...
deckard cain
1

votes
0

answer
503

Views

dynamic import json file

I used to load a json file like this: import faq from './faq.json' interface FAQ { title: string body: string } interface SiteConfig { title: string faqs: FAQ[] } sites: {[key: string]: SiteConfig} = { siteA: { title: 'xx', faqs: faq } } Now I want to use dynamic imports: interface FAQ { title: stri...
Chris

View additional questions