Questions tagged [python-3.6]
Version of the Python programming language released in December 2016. For issues specific to Python 3.6. Use more generic [python] and [python-3.x] tags where possible.
5,658
questions
1
vote
0
answers
37
views
Pandas does not have a function "read_sql"
Python 3.6 on RHEL 8, Pandas 1.1.5
Trying to use pandas to do a query, pd.read_sql(<my query>, conn).to_dict(orient="records")
Error message is: AttributeError: module 'pandas' has no ...
0
votes
1
answer
18
views
Python WSGI ignoring python-home virtual environment?
Using WSGI with Python 3.6 on RHEL 8 to run Flask on Apache.
In the WSGI configuration, we have the following line:
WSGIDaemonProcess myapp user=apache group=apache threads=5 python-home=/var/www/...
0
votes
0
answers
29
views
obfsproxy running on centos 7
I am using CentOS 7 os.
I installed python3.6 on this machine.
pip3 is latest version 21.
After that i installed obfsproxy like this :
To use obfsproxy you will need Python (>= 2.7) and pip.
pip3 ...
0
votes
1
answer
25
views
How to print matching json element value from nested json string
my_json file has list of nested dicts, I need to print only the username if type==Developer-Verified and it's value==1, I managed to print just the approvals list, unable to to go further.
$ cat ...
-1
votes
0
answers
34
views
PermissionError: [Errno 13] Permission denied: in Temp
Permisson error appears and the model stops working. When I searched it, it said it was an access or path setting problem, but I don't know which part to fix.
Full error message
Traceback (most ...
0
votes
1
answer
25
views
How to execute a value from coroutine object in sync celery task?
I have 2 functions - async, which returns the coroutine object with int value, and the sync function, whic is the @shared_task, where the variable must stores the value from the async function (int)
...
2
votes
1
answer
53
views
How to make only a method generic in a python class
I have the following base class to represent fields:
T = TypeVar("T")
@dataclass
class BaseClass(Generic[T]):
def validate(self, value: T):
raise NotImplementedError
I also ...
1
vote
1
answer
31
views
Get all required fields of a nested Python Pydantic model
My pydantic nested model is defined as below:
from pydantic import BaseModel
from typing import Optional
class Location(BaseModel):
city: Optional[str]
state: str
country: str
class User(...
0
votes
1
answer
24
views
Numpy loadtxt in python - except some colums
Is it possible in np.loadtxt to load all columns except the first one, or except some particular ones, please?
What does usecols = (0,) mean, please?
Is it possible to use sliders?
I have 55 columns, ...
0
votes
3
answers
54
views
Adding a key value into dictionary of list in python3
I have this data:
enquiry_metadata = {'enquiry_id': '02e19c4e21d2',
'items': [{'status': 'SUCCESS', 'code': 0, 'panelId': '0a1702be81bf', 'data': {'customerId': 19373, 'appId': 30531, 'zip': 80124, '...
0
votes
0
answers
26
views
Unable to create a conda environment based on yaml file due dependencies issue (protobuf issue)
hope you're doing well.
Wanted to know if you could help me out with the following issue.
I am trying to recreate a conda environment (old) in my local macbook M2 with some issues.
Here is the ...
-1
votes
0
answers
34
views
I downloaded python 3.6.2 and i am unable to open the IDLE
I downloaded the python 3.6.2 from the official website and installed in on my mac(macOS Monterey v12.6). It had no problems during installation. Then after installation , i clicked on the IDLE.app ...
0
votes
0
answers
12
views
In other environments, the package of python3 venv is not recognized
I'm developing python3 venv in my local environment.
And, I compressed the project by compressing the whole (including the venv folder) and executed it on another environment (closed server, can`t use ...
0
votes
0
answers
16
views
Roman to Integer Question. Problem with my Python solution [duplicate]
class Solution:
def romanToInt(self, s: str) -> int:
num = 0
for i in range(len(s)):
if s[i] == "I":
try:
if s[i+1] == &...
-2
votes
0
answers
17
views
Why doesn't `upper()` evaluate in the below formatted string?
I am using Python 3.6.13 and wondering why the following is throwing an error:
print("{x}\n{x.upper()}".format(x = "Chelsea! "*3))
The error being:
Traceback (most recent call ...
-2
votes
1
answer
74
views
Which version of python extension support python3.6 in vscode?
I'm shifting from pycharm to vscode for python development and want to check if most of functionality from pycharm such as debugging, gitlab integration, etc... Are possible in VScode.
I've learned ...
-1
votes
0
answers
62
views
Python 3.6: Format XML identical to `xmllint --format`
Is there a way to format XML identical to xmllint (from libxml2-utils package on Debian/Ubuntu) with Python 3.6?
xmllint seems to use a tab for indentation and one line per end node (i.e. <x>y&...
-3
votes
1
answer
31
views
what is pep 8? How does it help in programming? What are the set of rules regarding that?
what is the Full form and what it is used for?
I was going through basics of python when I came across this term. what does it mean by maximum readability?
0
votes
0
answers
18
views
Python: Kill sleeping thread
I'm looking for ways to end a thread that is handling alarms.
Right now I make use of threads started via concurrent.futures.thread.ThreadPoolExecutor and I have one thread that simply waits to be ...
0
votes
1
answer
47
views
How to import file from parent folder in python?
-> d:
-> project Main (folder)
-> my_file.py
-> class (My_Class_1)
-> class (My_class_2)
-> Folder_one
-> my_folder_one_file.py
Hai. I ...
0
votes
0
answers
33
views
'killed' error when trying to run inactive Python version (specifically, Python3.6) on M1 Mac?
I'm having trouble getting Python3.6 to run on my Mac M1.
First of all, Python3.6 can't be installed via brew. That's probably because 3.6 is no longer considered an active release. I downloaded the ...
0
votes
1
answer
24
views
I made image detection system using opencv in python but its now switching on the camera, can anyone please tell what can be the issue?
One of my friend said I should study about GUI for turning on the webcam in that system, Is it correct? or any other solution.
I made image detection system using opencv in python but its now ...
0
votes
0
answers
33
views
How to remove duplicate values and keys in list of nested dictionary in python?
I have a list of nested dictionaries like below:
data = [
{
"energy storage":[
"pmvalidation9998+peter@gmail.com",
"pmvalidation9998+pal@gmail.com&...
0
votes
0
answers
22
views
PackagesNotFoundError: The following packages are not available from current channels: [duplicate]
I am trying to create a new python enviroment with python=3.6 by using the following command conda create --prefix ./env python=3.6 but every time i am getting this error Following packages are not ...
0
votes
2
answers
36
views
Replace all off diagonal elements in numpy array
I have below numpy array
import numpy as np
np.identity(13)
Now I like to replace all off-diagonal elements with some other number, say 0.45.
Is there any direct method available to perform this?
0
votes
0
answers
47
views
Google Colab cntk import error: ModuleNotFoundError: No module named 'cntk._cntk_py'
The code I run are as follows: (link:https://colab.research.google.com/drive/1RBbhOx4XHOe8lCwHgwhGs12WcVBz_Vzu#scrollTo=pGCXryUwL949&uniqifier=6)
!sudo update-alternatives --config python3
!sudo ...
0
votes
0
answers
24
views
CR does not cause a line break when the file is opened in binary mode
I have a text file (hex representation)
61 0A 63 64 0A 0D 67 68 0D 6A 6B 6C 6D 6E 6F 70 71 72 0D 0A 75 76 77 78 79 7A 0A
with different newline characters:
0A (\n)
0D 0A (\r\n)
0D (\r)
...
0
votes
0
answers
26
views
Template error iterating through dict in jinja template
Here's my code
{% for key, value in dictionary.items() %}
<a class="dropdown-item" id={{key}}>{{value}}</a>
{% endfor %}
This is my dictionary
dictionary ={"A":&...
0
votes
1
answer
31
views
The application and the screen stop when running the code
I am a beginner in programming, and I found it difficult to overcome this problem, which is represented in the Android application that runs the Python code
The code works fine. But when I add while ...
0
votes
1
answer
311
views
How to solve ImportError: cannot import name 'DecisionBoundaryDisplay' from 'sklearn.inspection' in Google Colaboratory?
I am trying to design a decision surface of decision trees trained on pairs of features in my dataset in Google Colaboratory.
Example Code:
import matplotlib.pyplot as plt
from sklearn.datasets import ...
0
votes
0
answers
15
views
How can I add some noise to my SVM implementation?
my code run with no problems. what I was trying to do is add some noise to my dataset which I couldn't do .
so how can I do that ?
I tried many approach to do that :
-creating a noise function
-...
0
votes
0
answers
14
views
Is there any solution to cover the whole area of mat using ros python?
Need to cover the whole 2d area mat with the robot and it should push the cups outside . in ros python . and it should stay inside the mat.
I tried moving the robot in corners , but is not going to ...
1
vote
2
answers
78
views
Named tuples existence in a hashset
In [1]: x = set()
In [2]: pos = collections.namedtuple('Position', ['x','y'])
In [4]: x.add(pos(1,1))
In [5]: x
Out[5]: {Position(x=1, y=1)}
In [6]: pos(1,1) in x
Out[6]: True
In [8]: pos(1,2) in x
...
-7
votes
2
answers
60
views
How to convert to Python 3
I am in the process of converting Python 2 code into Python 3. Currently I am facing difficulty in converting the following code to Python 3. Please help.
print 'Data cache hit ratio: %4.2f%%' % ratio
...
0
votes
0
answers
17
views
Looking for more efficient way to pass arguments to subprocess.Popen
I have received a task that requires a python script to run on devices in our environment. The script should check for a certain criteria and generate an empty file in a subdirectory of /var/opt.
The ...
0
votes
0
answers
15
views
How to make importlib in python check for a module in specific paths dynamically
module = importlib.import_module(file)
generator = getattr(module, file)
genArgs = [outdir]
genObj = generator(*genArgs)
If i want the file to be picked from specific relative path
module = importlib....
0
votes
0
answers
17
views
List, Int and Input. Problem: ValueError: invalid literal for int() with base 10: ''
enter image description hereI have struggles with this one:
i become Error when u want to convert in int. Anyone know how can I fix this error?
thnks
I tried :
number = list(map(int, input("Next ...
0
votes
1
answer
103
views
Python3 pip upgrade and install fails
I think I have a broken pip.
When I try to install a package or upgrade pip, I get the following error:
python3 -m pip install --upgrade pip
Exception:
Traceback (most recent call last):
File "/...
1
vote
1
answer
108
views
Trouble Installing Python3.6 Virtual Environment on Ubuntu 22.04
Virtual environment stopped being created after upgrading to Ubuntu 22.04. Running the command
virtualenv venv -p python3.6
produces an error that did not occur in the previous version - Ubuntu 20.04.:...
0
votes
0
answers
27
views
ModuleNotFoundError: name 'face_recognition' is not defined
I try to build a license plate-recognition system following this project https://github.com/SyedUmaidAhmed/Vehicle-Plate-Recognition, but I have a problem while trying to import video. I installed ...
0
votes
0
answers
18
views
Getting the error PackageNotFound whenever iam trying to install something using conda
i am trying to create a new env with python 3.6 using conda. i have installed miniforge3 and anaconda. i have tried some the solutions but nothing worked for me.
The error i am getting everytime.
`
(...
0
votes
0
answers
58
views
asyncio.gather() is starting first two tasks but not the third one
I have a python function that is supposed to send packet asynchronously in a loop.
import asyncio
import logging
import pickle
from time import sleep
from decoder import decode, encode
from socket ...
0
votes
0
answers
21
views
How to iterate and find specific characters in a file using Python?
I have an exercise which I am struggling a lot with related to file handling in python. I tried a lot of times but keep on failing to create the program. Those are the 2 questions.
1) Write a program ...
0
votes
1
answer
39
views
Is there a Python function that encodes output for JavaScript contexts?
In Python 3.6+, is there a succinct way to encode output for JavaScript contexts?
This means, if I start with any unsanitized input string, encode it properly, then replace VALUE below with it, all ...
0
votes
1
answer
96
views
Pytest-cov does not show term or html reports
I am writing unit tests in python and trying to generate code coverage, but I am not seeing the term or HTML reports.
My Python component structure is as follows:
.
|-- README.md
|-- bin
| |-- ...
0
votes
0
answers
42
views
Can't unpickle a file in 3.6 Python
I had a pandas df a while back in 3.10 that I put into a .pkl pickle file. Because one of my modules is only available in 3.6, I had to revert the rest back to 3.6. However, I can't do pandas....
0
votes
0
answers
17
views
Unable to run any command using python3.6
Every time I attempt to run python3.6 I get the following error, how can I fix this?
enter image description here
1
vote
1
answer
45
views
ImportError: cannot import name for Python package
I am using Python 3.6 and I have a strange import error. My Python file contains only the line import formic. But when I execute the script, I get the following error:
from formic import FileSet, ...
0
votes
0
answers
13
views
pip install fasttext gives fatal error on Linux [duplicate]
I am trying to install fasttext using pip in my virtual environment on a Linux machine. Following is the error traceback I get on running pip install fasttext:
Building wheels for collected packages: ...
0
votes
1
answer
74
views
Leetcode 126: Word Ladder 2 in Python code optimization
I have the solution for the Word Ladder 2 (Leetcode problem 126: Word Ladder 2 ) in Python 3.6, and I notice that one of the very last testcases times out for me on the platform. Funnily, the test ...