ModuleNotFoundError: No module named 'pip._internal.models.target_pytho - modulenotfounderror

Error: Traceback (most recent call last):
File "C:\Users\Santosh Kumar\AppData\Local\JetBrains\PyCharm Community Edition 2022.2.2\plugins\python-ce\helpers\packaging_tool.py", line 73, in run_pip
runpy.run_module(module_name, run_name='main', alter_sys=True)
File "C:\Users\Santosh Kumar\AppData\Local\Programs\Python\Python36\lib\runpy.py", line 205, in run_module
return _run_module_code(code, init_globals, run_name, mod_spec)
File "C:\Users\Santosh Kumar\AppData\Local\Programs\Python\Python36\lib\runpy.py", line 96, in _run_module_code
mod_name, mod_spec, pkg_name, script_name)
File "C:\Users\Santosh Kumar\AppData\Local\Programs\Python\Python36\lib\runpy.py", line 85, in run_code
exec(code, run_globals)
File "C:\Users\Santosh Kumar\PycharmProjects\pythonProject2\venv\lib\site-packages\pip_main.py", line 29, in
from pip._internal.cli.main import main as _main
File "C:\Users\Santosh Kumar\PycharmProjects\pythonProject2\venv\lib\site-packages\pip_internal\cli\main.py", line 9, in
from pip._internal.cli.autocompletion import autocomplete
File "C:\Users\Santosh Kumar\PycharmProjects\pythonProject2\venv\lib\site-packages\pip_internal\cli\autocompletion.py", line 10, in
from pip._internal.cli.main_parser import create_main_parser
File "C:\Users\Santosh Kumar\PycharmProjects\pythonProject2\venv\lib\site-packages\pip_internal\cli\main_parser.py", line 8, in
from pip._internal.cli import cmdoptions
File "C:\Users\Santosh Kumar\PycharmProjects\pythonProject2\venv\lib\site-packages\pip_internal\cli\cmdoptions.py", line 29, in
from:
pip._internal.models.target_python
import TargetPython
ModuleNotFoundError: No module named 'pip._internal.models.target_python'

Related

Estimating Region covered by all sides

I need some help in estimating somekind of of morphological operations(preferably using skimage or scipy image or python in general) that can help me isolate the regions that are enclosed by all sides(see images.) The problem is the outer shell can be of varied shape and size. The enclosed regions are also of varied shapes and sizes.
Examples of the image where the enclosed(by the white regions) black region needs to isolated.
By isolation I mean to get all the pixel coordinates in the enclosed black regions.
Example 1
Example 2
Also another caveat is that the images like this should not be filled up.
Use scipy.ndimage.binary_fill_holes
from scipy import ndimage as ndi
filled = ndi.binary_fill_holes(image)
holes = filled - image # or np.logical_xor(filled, image)
I prefer #Juan's solution, but just for fun, here's a slightly different approach. Floodfill with white starting from the top-left corner and your fully-enclosed pixels will be all that is left over.
#!/usr/bin/env python3
import numpy as np
from skimage.segmentation import flood_fill
import cv2
im = cv2.imread('scan.png', cv2.IMREAD_GRAYSCALE)
# Fill with white from top-left
filled = flood_fill(im, (0, 0), 255)
# Save result
cv2.imwrite('DEBUG-result.png', filled)
# Get list of black pixels
blk = np.where(filled==0)
print(f'Number of fully enclosed black pixels: {len(blk[0])}')
print(blk)
So that you can see the extent of the image, I have artificially added a red border:
Here is the output:
Number of fully enclosed black pixels: 957
(array([364, 364, 364, 364, 364, 364, 364, 364, 364, 364, 364, 364, 364,
364, 364, 364, 364, 364, 364, 364, 364, 364, 364, 364, 364, 364,
364, 364, 364, 364, 364, 364, 364, 365, 365, 365, 365, 365, 365,
365, 365, 365, 365, 365, 365, 365, 365, 365, 365, 365, 365, 365,
365, 365, 365, 365, 365, 365, 365, 365, 365, 365, 365, 365, 365,
365, 366, 366, 366, 366, 366, 366, 366, 366, 366, 366, 366, 366,
366, 366, 366, 366, 366, 366, 366, 366, 366, 366, 366, 366, 366,
366, 366, 366, 366, 366, 366, 366, 366, 367, 367, 367, 367, 367,
367, 367, 367, 367, 367, 367, 367, 367, 367, 367, 367, 367, 367,
367, 367, 367, 367, 367, 367, 367, 367, 367, 367, 367, 367, 367,
367, 367, 367, 367, 367, 368, 368, 368, 368, 368, 368, 368, 368,
368, 368, 368, 368, 368, 368, 368, 368, 368, 368, 368, 368, 368,
368, 368, 368, 368, 368, 368, 368, 368, 368, 368, 368, 368, 368,
368, 368, 369, 369, 369, 369, 369, 369, 369, 369, 369, 369, 369,
369, 369, 369, 369, 369, 369, 369, 369, 369, 369, 369, 369, 369,
369, 369, 369, 369, 369, 369, 369, 369, 369, 369, 369, 369, 370,
370, 370, 370, 370, 370, 370, 370, 370, 370, 370, 370, 370, 370,
370, 370, 370, 370, 370, 370, 370, 370, 370, 370, 370, 370, 370,
370, 370, 370, 370, 370, 370, 370, 370, 370, 371, 371, 371, 371,
371, 371, 371, 371, 371, 371, 371, 371, 371, 371, 371, 371, 371,
371, 371, 371, 371, 371, 371, 371, 371, 371, 371, 371, 371, 371,
371, 371, 371, 371, 371, 371, 372, 372, 372, 372, 372, 372, 372,
372, 372, 372, 372, 372, 372, 372, 372, 372, 372, 372, 372, 372,
372, 372, 372, 372, 372, 372, 372, 372, 372, 372, 372, 372, 372,
372, 372, 372, 373, 373, 373, 373, 373, 373, 373, 373, 373, 373,
373, 373, 373, 373, 373, 373, 373, 373, 373, 373, 373, 373, 373,
373, 373, 373, 373, 373, 373, 373, 373, 373, 373, 374, 374, 374,
374, 374, 374, 374, 374, 374, 374, 374, 374, 374, 374, 374, 374,
374, 374, 374, 374, 374, 374, 374, 374, 374, 374, 374, 374, 374,
374, 374, 374, 374, 375, 375, 375, 375, 375, 375, 375, 375, 375,
375, 375, 375, 375, 375, 375, 375, 375, 375, 375, 375, 375, 375,
375, 375, 375, 375, 375, 375, 375, 375, 375, 375, 375, 376, 376,
376, 376, 376, 376, 376, 376, 376, 376, 376, 376, 376, 376, 376,
376, 376, 376, 376, 376, 376, 376, 376, 376, 376, 376, 376, 376,
376, 376, 376, 376, 376, 377, 377, 377, 377, 377, 377, 377, 377,
377, 377, 377, 377, 377, 377, 377, 377, 377, 377, 377, 377, 377,
377, 377, 377, 377, 377, 377, 377, 377, 377, 377, 377, 377, 378,
378, 378, 378, 378, 378, 378, 378, 378, 378, 378, 378, 378, 378,
378, 378, 378, 378, 378, 378, 378, 378, 378, 378, 378, 378, 378,
378, 378, 378, 378, 378, 378, 379, 379, 379, 379, 379, 379, 379,
379, 379, 379, 379, 379, 379, 379, 379, 379, 379, 379, 379, 379,
379, 379, 379, 379, 379, 379, 379, 379, 379, 379, 379, 379, 379,
380, 380, 380, 380, 380, 380, 380, 380, 380, 380, 380, 380, 380,
380, 380, 380, 380, 380, 380, 380, 380, 380, 380, 380, 380, 380,
380, 380, 380, 380, 380, 380, 380, 381, 381, 381, 381, 381, 381,
381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381,
381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381,
381, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382,
382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382,
382, 382, 382, 382, 382, 382, 382, 382, 383, 383, 383, 383, 383,
383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383,
383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383,
383, 383, 384, 384, 384, 384, 384, 384, 384, 384, 384, 384, 384,
384, 384, 384, 384, 384, 384, 384, 384, 384, 384, 384, 384, 384,
384, 384, 384, 384, 384, 384, 384, 384, 384, 385, 385, 385, 385,
385, 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, 385,
385, 385, 385, 385, 385, 385, 385, 386, 386, 386, 386, 386, 386,
386, 386, 386, 386, 386, 386, 386, 386, 386, 386, 386, 386, 386,
386, 386, 386, 386, 386, 387, 387, 387, 387, 387, 387, 387, 387,
387, 387, 387, 387, 387, 387, 387, 387, 387, 387, 387, 387, 387,
387, 387, 387, 388, 388, 388, 388, 388, 388, 388, 388, 388, 388,
388, 388, 388, 388, 388, 388, 388, 388, 388, 388, 388, 389, 389,
389, 389, 389, 389, 389, 389, 389, 389, 389, 389, 389, 389, 389,
389, 389, 389, 389, 389, 389, 390, 390, 390, 390, 390, 390, 390,
390, 390, 390, 390, 390, 390, 390, 390, 390, 390, 390, 390, 390,
390, 391, 391, 391, 391, 391, 391, 391, 391, 391, 391, 391, 391,
391, 391, 391, 392, 392, 392, 392, 392, 392, 392, 392, 392, 392,
392, 392, 392, 392, 392, 393, 393, 393, 393, 393, 393, 393, 393,
393, 393, 393, 393, 393, 393, 393, 394, 394, 394, 394, 394, 394,
394, 394, 394, 394, 394, 394, 394, 394, 394, 395, 395, 395, 395,
395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 396, 396,
396, 396, 396, 396, 396, 396, 396, 397, 397, 397, 397, 397, 397,
397, 397, 397, 398, 398, 398, 398, 398, 398, 398, 398, 398, 399,
399, 399, 400, 400, 400, 401, 401, 401]), array([244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256,
257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269,
270, 271, 272, 273, 274, 275, 276, 244, 245, 246, 247, 248, 249,
250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262,
263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275,
276, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255,
256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268,
269, 270, 271, 272, 273, 274, 275, 276, 241, 242, 243, 244, 245,
246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258,
259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271,
272, 273, 274, 275, 276, 241, 242, 243, 244, 245, 246, 247, 248,
249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261,
262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
275, 276, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251,
252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264,
265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 241,
242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254,
255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267,
268, 269, 270, 271, 272, 273, 274, 275, 276, 241, 242, 243, 244,
245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257,
258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270,
271, 272, 273, 274, 275, 276, 241, 242, 243, 244, 245, 246, 247,
248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260,
261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273,
274, 275, 276, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250,
251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263,
264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 241, 242, 243,
244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256,
257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269,
270, 271, 272, 273, 241, 242, 243, 244, 245, 246, 247, 248, 249,
250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262,
263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 241, 242,
243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255,
256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268,
269, 270, 271, 272, 273, 241, 242, 243, 244, 245, 246, 247, 248,
249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261,
262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 241,
242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254,
255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267,
268, 269, 270, 271, 272, 273, 241, 242, 243, 244, 245, 246, 247,
248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260,
261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273,
241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253,
254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266,
267, 268, 269, 270, 271, 272, 273, 241, 242, 243, 244, 245, 246,
247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259,
260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272,
273, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252,
253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265,
266, 267, 268, 269, 270, 271, 272, 273, 241, 242, 243, 244, 245,
246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258,
259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271,
272, 273, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251,
252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264,
265, 266, 267, 268, 269, 270, 271, 272, 273, 253, 254, 255, 256,
257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269,
270, 271, 272, 273, 274, 275, 276, 253, 254, 255, 256, 257, 258,
259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271,
272, 273, 274, 275, 276, 253, 254, 255, 256, 257, 258, 259, 260,
261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273,
274, 275, 276, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265,
266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 256, 257,
258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270,
271, 272, 273, 274, 275, 276, 256, 257, 258, 259, 260, 261, 262,
263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275,
276, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270,
271, 272, 273, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268,
269, 270, 271, 272, 273, 259, 260, 261, 262, 263, 264, 265, 266,
267, 268, 269, 270, 271, 272, 273, 259, 260, 261, 262, 263, 264,
265, 266, 267, 268, 269, 270, 271, 272, 273, 259, 260, 261, 262,
263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 262, 263,
264, 265, 266, 267, 268, 269, 270, 262, 263, 264, 265, 266, 267,
268, 269, 270, 262, 263, 264, 265, 266, 267, 268, 269, 270, 265,
266, 267, 265, 266, 267, 265, 266, 267]))
Hopefully you can see from the first element of each array that the first black pixel is at 364,244
Note that, if there is the possibility that the scan would touch the edge of the image, the flood-fill will fail to "flow" all the way around the edges. In this case, you can simply add a 1-pixel wide black border all the way around the edge for the floodfill to flow around... and remove it afterwards.

DLL load failure while installing module

Whenever I am trying to install any module I get the following error
File "c:\users\agniva roy\lib\runpy.py", line 194, in _run_module_as_main
return _run_code(code, main_globals, None,
File "c:\users\agniva roy\lib\runpy.py", line 87, in _run_code
exec(code, run_globals)
File "C:\Users\Agniva Roy\Scripts\pip.exe\__main__.py", line 4, in <module>
File "c:\users\agniva roy\lib\site-packages\pip\_internal\cli\main.py", line 10, in <module>
from pip._internal.cli.autocompletion import autocomplete
File "c:\users\agniva roy\lib\site-packages\pip\_internal\cli\autocompletion.py", line 9, in <module>
from pip._internal.cli.main_parser import create_main_parser
File "c:\users\agniva roy\lib\site-packages\pip\_internal\cli\main_parser.py", line 7, in <module>
from pip._internal.cli import cmdoptions
File "c:\users\agniva roy\lib\site-packages\pip\_internal\cli\cmdoptions.py", line 25, in <module>
from pip._internal.cli.progress_bars import BAR_TYPES
File "c:\users\agniva roy\lib\site-packages\pip\_internal\cli\progress_bars.py", line 12, in <module>
from pip._internal.utils.logging import get_indentation
File "c:\users\agniva roy\lib\site-packages\pip\_internal\utils\logging.py", line 9, in <module>
import logging.handlers
File "c:\users\agniva roy\lib\logging\handlers.py", line 26, in <module>
import logging, socket, os, pickle, struct, time, re
File "c:\users\agniva roy\lib\socket.py", line 49, in <module>
import _socket
ImportError: DLL load failed while importing _socket: The specified module could not be found.
Please do help me out

Python fbprophet - export values from plot_components() for yearly

Any ideas on how to export the yearly seasonal trend using fbprophet library?
The plot_components() function plots the trend, yearly, and weekly.
I want to obtain the values for yearly only.
Example data:
import pandas as pd
from fbprophet import Prophet
import matplotlib.pyplot as plt
df = pd.DataFrame.from_dict({'ds': ['1949-01', '1949-02', '1949-03', '1949-04', '1949-05', '1949-06',
'1949-07', '1949-08', '1949-09', '1949-10', '1949-11', '1949-12',
'1950-01', '1950-02', '1950-03', '1950-04', '1950-05', '1950-06',
'1950-07', '1950-08', '1950-09', '1950-10', '1950-11', '1950-12',
'1951-01', '1951-02', '1951-03', '1951-04', '1951-05', '1951-06',
'1951-07', '1951-08', '1951-09', '1951-10', '1951-11', '1951-12',
'1952-01', '1952-02', '1952-03', '1952-04', '1952-05', '1952-06',
'1952-07', '1952-08', '1952-09', '1952-10', '1952-11', '1952-12',
'1953-01', '1953-02', '1953-03', '1953-04', '1953-05', '1953-06',
'1953-07', '1953-08', '1953-09', '1953-10', '1953-11',
'1953-12',
'1954-01', '1954-02', '1954-03', '1954-04', '1954-05', '1954-06',
'1954-07', '1954-08', '1954-09', '1954-10', '1954-11', '1954-12',
'1955-01', '1955-02', '1955-03', '1955-04', '1955-05', '1955-06',
'1955-07', '1955-08', '1955-09', '1955-10', '1955-11', '1955-12',
'1956-01', '1956-02', '1956-03', '1956-04', '1956-05', '1956-06',
'1956-07', '1956-08', '1956-09', '1956-10', '1956-11', '1956-12',
'1957-01', '1957-02', '1957-03', '1957-04', '1957-05', '1957-06',
'1957-07', '1957-08', '1957-09', '1957-10', '1957-11', '1957-12',
'1958-01', '1958-02', '1958-03', '1958-04', '1958-05', '1958-06',
'1958-07', '1958-08', '1958-09', '1958-10', '1958-11', '1958-12',
'1959-01', '1959-02', '1959-03', '1959-04', '1959-05', '1959-06',
'1959-07', '1959-08', '1959-09', '1959-10', '1959-11', '1959-12',
'1960-01', '1960-02', '1960-03', '1960-04', '1960-05', '1960-06',
'1960-07', '1960-08', '1960-09', '1960-10', '1960-11', '1960-12'],
'y': [112, 118, 132, 129, 121, 135, 148, 148, 136, 119, 104, 118, 115, 126,
141, 135, 125, 149, 170, 170, 158, 133, 114, 140, 145, 150, 178, 163,
172, 178, 199, 199, 184, 162, 146, 166, 171, 180, 193, 181, 183, 218,
230, 242, 209, 191, 172, 194, 196, 196, 236, 235, 229, 243, 264, 272,
237, 211, 180, 201, 204, 188, 235, 227, 234, 264, 302, 293, 259, 229,
203, 229, 242, 233, 267, 269, 270, 315, 364, 347, 312, 274, 237, 278,
284, 277, 317, 313, 318, 374, 413, 405, 355, 306, 271, 306, 315, 301,
356, 348, 355, 422, 465, 467, 404, 347, 305, 336, 340, 318, 362, 348,
363, 435, 491, 505, 404, 359, 310, 337, 360, 342, 406, 396, 420, 472,
548, 559, 463, 407, 362, 405, 417, 391, 419, 461, 472, 535, 622, 606,
508, 461, 390, 432]})
df['ds'] = pd.to_datetime(df['ds'])
fbprophet plot_components():
model = Prophet()
model.fit(df)
future = model.make_future_dataframe(12, 'm')
fc = model.predict(future)
model.plot_components(fc)
plt.show()
I understand your question to mean "How do we get the values used in the "yearly" plot above?
days = (pd.date_range(start='2017-01-01', periods=365) + pd.Timedelta(days=0))
df_y = model.seasonality_plot_df(days)
seas = model.predict_seasonal_components(df_y)
fig,ax = plt.subplots(2, 1, figsize=(8,6))
ax[0].plot(fc['ds'].dt.to_pydatetime(), fc['trend'])
ax[0].grid(alpha=0.5)
ax[0].set_xlabel('ds')
ax[1].set_ylabel('trend')
ax[1].plot(df_y['ds'].dt.to_pydatetime(), seas['yearly'], ls='-', c='#0072B2')
ax[1].set_xlabel('Day of year')
ax[1].set_ylabel('yearly')
ax[1].grid(alpha=0.5)
plt.show()
Plot results:
How to obtain the values for yearly only?
The X values are an arbitrary yearly time period (basically). The y values use functions seasonality_plot_df() and predict_seasonal_components() to predict daily seasonality for a year time-span. You retrieve these values by looking in seas['yearly'].
There is a simple solution in the current version of the library. You can use from the predicted model fc. What you want for the value of yearly can be found with fc['yearly'] without using the functions in the above solution.
Moreover, if you want all the other components like trend, you can use fc['trend'].

Unable to execute pyinstaller compiled binary for Windows

I wrote a script in Python 3.5.2 and compiled it to a binary on Mac which works fine.
I then compiled the script on my Win 7 machine pyinstaller --onefile script.py. There were no errors during the compilation, however its execution fails.
Below is the full traceback.
Traceback (most recent call last):
File "site-packages\requests\packages\__init__.py", line 27, in <module>
File "c:\users\support\appdata\local\programs\python\python35\lib\site-packages\PyInstaller\loader
\pyimod03_importers.py", line 389, in load_module
exec(bytecode, module.__dict__)
File "site-packages\requests\packages\urllib3\__init__.py", line 8, in <module>
File "c:\users\support\appdata\local\programs\python\python35\lib\site-packages\PyInstaller\loader
\pyimod03_importers.py", line 389, in load_module
exec(bytecode, module.__dict__)
File "site-packages\requests\packages\urllib3\connectionpool.py", line 28, in <module>
File "site-packages\requests\packages\urllib3\packages\six.py", line 92, in __get__
File "site-packages\requests\packages\urllib3\packages\six.py", line 115, in _resolve
File "site-packages\requests\packages\urllib3\packages\six.py", line 82, in _import_module
ImportError: No module named 'queue'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "myscript.py", line 5, in <module>
import support
File "c:\users\support\appdata\local\programs\python\python35\lib\site-packages\PyInstaller\loader
\pyimod03_importers.py", line 389, in load_module
exec(bytecode, module.__dict__)
File "support.py", line 1, in <module>
import requests
File "c:\users\support\appdata\local\programs\python\python35\lib\site-packages\PyInstaller\loader
\pyimod03_importers.py", line 389, in load_module
exec(bytecode, module.__dict__)
File "site-packages\requests\__init__.py", line 63, in <module>
File "c:\users\support\appdata\local\programs\python\python35\lib\site-packages\PyInstaller\loader
\pyimod03_importers.py", line 389, in load_module
exec(bytecode, module.__dict__)
File "site-packages\requests\utils.py", line 24, in <module>
File "c:\users\support\appdata\local\programs\python\python35\lib\site-packages\PyInstaller\loader
\pyimod03_importers.py", line 389, in load_module
exec(bytecode, module.__dict__)
File "site-packages\requests\_internal_utils.py", line 11, in <module>
File "c:\users\support\appdata\local\programs\python\python35\lib\site-packages\PyInstaller\loader
\pyimod03_importers.py", line 389, in load_module
exec(bytecode, module.__dict__)
File "site-packages\requests\compat.py", line 11, in <module>
File "c:\users\support\appdata\local\programs\python\python35\lib\site-packages\PyInstaller\loader
\pyimod03_importers.py", line 389, in load_module
exec(bytecode, module.__dict__)
File "site-packages\requests\packages\__init__.py", line 29, in <module>
File "c:\users\support\appdata\local\programs\python\python35\lib\site-packages\PyInstaller\loader
\pyimod03_importers.py", line 389, in load_module
exec(bytecode, module.__dict__)
File "site-packages\urllib3\__init__.py", line 8, in <module>
File "c:\users\support\appdata\local\programs\python\python35\lib\site-packages\PyInstaller\loader
\pyimod03_importers.py", line 389, in load_module
exec(bytecode, module.__dict__)
File "site-packages\urllib3\connectionpool.py", line 28, in <module>
File "site-packages\urllib3\packages\six.py", line 92, in __get__
File "site-packages\urllib3\packages\six.py", line 115, in _resolve
File "site-packages\urllib3\packages\six.py", line 82, in _import_module
ImportError: No module named 'queue'
Failed to execute script myscript
I don't know what's wrong.
Sometimes,decode errors were found.
For example: GBK cann't decode.some special code : .\?-_... .Check your code!

'list' object is not callable python

numbers = [
951, 402, 984, 651, 360, 69, 408, 319, 601, 485, 980, 507, 725, 547, 544,
615, 83, 165, 141, 501, 263, 617, 865, 575, 219, 390, 984, 592, 236, 105, 942, 941,
386, 462, 47, 418, 907, 344, 236, 375, 823, 566, 597, 978, 328, 615, 953, 345,
399, 162, 758, 219, 918, 237, 412, 566, 826, 248, 866, 950, 626, 949, 687, 217,
815, 67, 104, 58, 512, 24, 892, 894, 767, 553, 81, 379, 843, 831, 445, 742, 717,
958, 609, 842, 451, 688, 753, 854, 685, 93, 857, 440, 380, 126, 721, 328, 753, 470,
743, 527]
count=0
while numbers(count)==527:
print(numbers(count))
count+=1
may in know what is the error in above code?
what is meant by "'list' object is not callable"
please correct the code
thanks.
numbers(count) replace on numbers[count]
count=0
while numbers[count]!=527:
print(numbers(count))
count+=1
If you want print all numbers except last:
for item in numbers[0:-1]:
print(item)
while numbers(count)==527: means that numbers is interpreted as a function with one argument, count. numbers is actually a list object, so when the interpreter tries to call the 'function' it will return the error you're seeing.
You need to use [] for indexing and slicing.
Your revised code would look like this:
numbers = [
951, 402, 984, 651, 360, 69, 408, 319, 601, 485, 980, 507, 725, 547, 544,
615, 83, 165, 141, 501, 263, 617, 865, 575, 219, 390, 984, 592, 236, 105, 942, 941,
386, 462, 47, 418, 907, 344, 236, 375, 823, 566, 597, 978, 328, 615, 953, 345,
399, 162, 758, 219, 918, 237, 412, 566, 826, 248, 866, 950, 626, 949, 687, 217,
815, 67, 104, 58, 512, 24, 892, 894, 767, 553, 81, 379, 843, 831, 445, 742, 717,
958, 609, 842, 451, 688, 753, 854, 685, 93, 857, 440, 380, 126, 721, 328, 753, 470,
743, 527]
count=0
while numbers[count]!=527:
print(numbers[count])
count+=1
This will print every item in numbers up until you get to the first instance of 527.

Resources