22,710 questions
0
votes
2
answers
54
views
pytorch Module B=A, A.to('cpu'), but the tensor in B is still in GPU, why?
After converting module A to CPU, the origin parameter tensor still stays on the GPU? When it is released? Is it wrong if I reuse the parameter?
My code:
import torch.nn as nn
class A(nn.Module):
...
0
votes
2
answers
53
views
python: vscode doesnt highlight direct import from module
When I attempt to import a module from a local package (from core import config), VSCode's syntax highlighting isn't working. When hovering over config, it shows "config: Any" (the editor ...
0
votes
0
answers
84
views
Why does Visual Studio mention the symbol loading to be disabled by Include/Exclude setting? [duplicate]
I'm debugging a C++ program, and in order to do that, I'd like to have a look at objects, defined in imported libraries. However, the "Modules" window mentions some symbols not to be loaded ...
1
vote
1
answer
117
views
How do I convert a JavaFX application into an executable .jar file with all dependencies included?
I’ve built a modular JavaFX application using JDK 21 and JavaFX SDK 21.0.1. The project runs perfectly inside my IDE (IntelliJ IDEA), but when I try to export it as a .jar file and run it outside the ...
3913
votes
14
answers
2.8m
views
What is __init__.py for?
What is __init__.py for in a Python source directory?
1159
votes
33
answers
1.7m
views
Importing modules from parent folder
I am running Python 2.5.
This is my folder tree:
ptdraft/
nib.py
simulations/
life/
life.py
(I also have __init__.py in each folder, omitted here for readability)
How do I import the ...
0
votes
0
answers
107
views
How to make #[cfg(test)] gated code in one module, visible to #[cfg(test)] code in another module in Rust?
I have some code I am working on that has a certain struct object Permissions:-
// Stores permissions with a bit flag
/// 1 << ? - Vote - Anyone with a weight > 0 can vote.
/// 1 << ? -...
1154
votes
26
answers
1.3m
views
How to retrieve a module's path?
I want to detect whether module has changed. Now, using inotify is simple, you just need to know the directory you want to get notifications from.
How do I retrieve a module's path in python?
0
votes
2
answers
114
views
How do I import package when running
I have a directory structure that can be simplified like this:
test/
scripts/
a.py
src/
b.py
In a.py, I have the line:
import src.b
If I'm in the test directory, I want this ...
0
votes
0
answers
26
views
Wordpress assets loading. Uncaught TypeError: Failed to resolve module specifier
I hope you can help me with one, it's drivinig me crazy :(
I recently splitted a giant file called admin.js into many modules, using these two WordPress functions:
wp_register_script_module
...
15
votes
4
answers
6k
views
No module named 'matplotlib.backends.registry'
I started learning matplotlib with the Python Data Science Handbook by Jake VanderPlas that starts with this code for importing and setting style:
%matplotlib inline
import matplotlib.pyplot as plt
...
2
votes
1
answer
52
views
vscode breakpoints in an imported module do not work suddenly [closed]
I encountered a weird problem about vscode breakpoints for python in an imported module.
The module is in the subfolder 'src' of the working folder of the main program 'main.py'.
Then the main program ...
290
votes
8
answers
342k
views
How to point Go module dependency in go.mod to a latest commit in a repo?
Starting with v1.11 Go added support for modules. Commands
go mod init <package name>
go build
would generate go.mod and go.sum files that contain all found versions for the package ...
374
votes
17
answers
281k
views
How can I conditionally import an ES6 module?
I need to do something like:
if (condition) {
import something from 'something';
}
// ...
if (something) {
something.doStuff();
}
The above code does not compile; it throws SyntaxError: ... '...
0
votes
0
answers
74
views
Why Odoo custom module code changes are not reflected in website?
I’m building a website using a custom Odoo module. I created a hero section on the homepage, and I can see it correctly at localhost:8070.
The issue is that after making several changes and adding new ...
627
votes
22
answers
930k
views
How do I find the location of Python module sources? [duplicate]
How do I learn where the source file for a given Python module is installed? Is the method different on Windows than on Linux?
I'm trying to look for the source of the datetime module in particular, ...
866
votes
10
answers
377k
views
What's the difference between a module and package in Python?
What's the difference between a module and package in Python?
See also: What's the difference between "package" and "module"? (for other languages)
361
votes
27
answers
412k
views
I can't install python-ldap
When I run the following command:
sudo pip install python-ldap
I get this error:
In file included from Modules/LDAPObject.c:9:
Modules/errors.h:8: fatal error: lber.h: No such file or directory
How ...
1
vote
1
answer
83
views
vscode can't run program in playground ... says it can't find module on github
I have a helloWorld program with a package
helloWorld
|----- morestrings
|------- reverse.go
|------- reverse_test.go
|--- hello.go
|--- go.mod
...
-3
votes
1
answer
62
views
whenever I atteempt to install a module I get an error
Currently trying to make voice commands for my PC. Whenever I try to install any module's, I get WARNING: Ignoring invalid distribution ~ (C:\Users\Username\AppData\Local\Programs\Python\Python311\Lib\...
186
votes
11
answers
119k
views
Angular 8 - Lazy loading modules : Error TS1323: Dynamic import is only supported when '--module' flag is 'commonjs' or 'esNext'
When I updated Angular from 7 to Angular 8, getting error for lazy loading modules
I have tried the options, which are there in the angular upgradation guide
Made the below changes:
Before
...
902
votes
6
answers
201k
views
Relation between CommonJS, AMD and RequireJS?
I'm still very confused about CommonJS, AMD and RequireJS, even after reading a lot.
I know that CommonJS (formerly ServerJS) is a group for defining some JavaScript specifications (i.e. modules) when ...
299
votes
10
answers
237k
views
How do I use namespaces with TypeScript external modules?
I have some code:
baseTypes.ts
export namespace Living.Things {
export class Animal {
move() { /* ... */ }
}
export class Plant {
photosynthesize() { /* ... */ }
}
}
dog.ts
import b ...
0
votes
1
answer
87
views
Change module name displayed by Rust log macros to be from calling code for auxiliary functions
My goal
I'm trying to make my actix-web code more readable and came up with the idea that I want to extend Result with methods that transform errors into actix specific ones with status code etc. (so ...
268
votes
21
answers
378k
views
Node.js cannot find installed module on Windows
I am learning Node.js at the moment on Windows. Several modules are installed globally with npm.cmd, and Node.js failed to find the installed modules. Take Jade, for example,
npm install jade -g
Jade ...