Questions tagged [module]

A logical subdivision of a larger, more complex system.

Modules are a convenient way to break down a larger problem and divide it into smaller problems/solutions. This way the main problem can be broken down into separate parts that can be worked on independently. For example, one module could consist of a the printing functionality of program, which can be handed to one programmer. The GUI (Graphical User Interface) could be another module, handed to another programmer, and so forth.

Modular design is meant to improve efficiency and speed of development by allowing programmers to work on specific aspects of the program independently of each other.

22551 questions
107
votes
17 answers

"ImportError: No module named site" on Windows

I am trying to install Python for the first time. I downloaded the following installer from the Python website: Python 2.7.1 Windows Installer (Windows binary -- does not include source). I then ran the installer, selected 'All Users' and all was…
Mimminito
  • 2,803
  • 3
  • 21
  • 27
107
votes
15 answers

Module Not Found - No module named

Here's my Python folder structure -project ----src ------model --------order.py ------hello-world.py Under src I have a folder named model which has a Python file called order.py which contents follow: class SellOrder(object): def…
user962206
  • 15,637
  • 61
  • 177
  • 270
101
votes
2 answers

How to make an "always relative to current module" file path?

Let's say you have a module which contains myfile = open('test.txt', 'r') And the 'test.txt' file is in the same folder. If you'll run the module, the file will be opened successfully. Now, let's say you import that module from another one which is…
user975135
99
votes
17 answers

Uncaught ReferenceError: process is not defined

I am using node.js to create a web application. When I run the application (either by opening index.html on the browser or using the command "npm start" on the terminal) I get two errors: Uncaught ReferenceError: process is not defined …
Kantharis
  • 1,316
  • 1
  • 11
  • 21
98
votes
5 answers

How do I update an NPM module that I published?

I created a NPM module and I published it at version 0.0.1 I made some changes and pushed those to github, and I would like it so that when one uses npm install myModule the new version is used. How do I tell NPM that there is a version 0.0.2?
ThomasReggi
  • 55,053
  • 85
  • 237
  • 424
97
votes
6 answers

Export default was not found

I have a Vue 2 project, and I've written a simple function for translating months in dates, which I would like to import in one of my components, but I'm getting an error: export 'default' (imported as 'translateDate') was not found in…
Leff
  • 1,968
  • 24
  • 97
  • 201
97
votes
6 answers

Python Module Import: Single-line vs Multi-line

When importing modules in Python, what is the difference between this: from module import a, b, c, d and this from module import a from module import b from module import c from module import d To me it makes sense always to condense code and use…
Cody Brown
  • 1,409
  • 2
  • 15
  • 19
96
votes
1 answer

What the difference between a namespace and a module in F#?

I've just started learning F# (with little prior experience with .NET) so forgive me for what is probably a very simple question: What the difference between a namespace and a module in F#? Thanks Dave Edit: Thanks for the answer Brian. That's what…
Dave Berk
  • 1,591
  • 2
  • 15
  • 17
96
votes
11 answers

Difference between a module, library and a framework

In popular programming speak, what is the difference between these terms and what are the overlaps? Any related terms I'm missing out?
jetru
  • 1,964
  • 4
  • 16
  • 24
92
votes
5 answers

ES6 modules in the browser: Uncaught SyntaxError: Unexpected token import

I'm new to ES6 (ECMAScript 6), and I'd like to use its module system in the browser. I read ES6 is supported by Firefox and Chrome, but I'm getting the following error using export Uncaught SyntaxError: Unexpected token import I have a test.html…
cdarwin
  • 4,141
  • 9
  • 42
  • 66
91
votes
2 answers

How to create and use a module using Ruby on Rails 3?

I am using Ruby on Rails 3 and I would like to move some custom and shared code in a module. What syntax should I use to write the module code? In which folder of my application I have to place the module file? How I have to include that module in…
user502052
  • 14,803
  • 30
  • 109
  • 188
90
votes
1 answer

How to use code from script with type=module

I can't figure out why this trivial code is not working: index.html:
tromgy
  • 4,937
  • 3
  • 17
  • 18
89
votes
2 answers

Typescript: How to export a variable

I want to open 'file1.ts' and write: export var arr = [1,2,3]; and open another file, let's say 'file2.ts' and access directly to 'arr' in file1.ts: I do it by: import {arr} from './file1'; However, when I want to access 'arr', I can't just…
CrazySynthax
  • 13,662
  • 34
  • 99
  • 183
89
votes
15 answers

Finding the root directory of a multi module Maven reactor project

Is there an easy way to find the root of a multi-module Maven project, like Gradle's rootDir? Background: I want to use the maven-dependency-plugin to copy artifacts from all sub-modules of my multi-module project to a directory that is relative to…
Christoffer Hammarström
  • 27,242
  • 4
  • 49
  • 58
88
votes
22 answers

ImportError: No module named 'selenium'

I'm trying to write a script to check a website. It's the first time I'm using selenium. I'm trying to run the script on a OSX system. Although I checked in /Library/Python/2.7/site-packages and selenium-2.46.0-py2.7.egg is present, when I run the…
Giulio Colleluori
  • 1,261
  • 2
  • 10
  • 16