Questions tagged [except]
Used for the MS .NET LINQ Except() method and the Python except keyword for exception handling. Use the tag sql-except for questions related to the SQL operator EXCEPT
600
questions
0
votes
1
answer
51
views
Use ExceptBy set operation with list of Keyselectors instead of single selector in C#
I am working on a project where I have an Excel sheet with some data. I am converting it into list and mapping it into another list which is derived from table in a database using entity framework ...
1
vote
1
answer
25
views
How to Filter a Disconnected Table
I have a main table (Table 1) and I have created another table which is called rangeBefore (Table 2):
rangedBefore (Table 2) =
FILTER (
SUMMARIZE ( 'Campaign Overview', 'Campaign Overview'[campaign],'...
0
votes
0
answers
7
views
Listing all open workbooks except Current within combobox vba
I am currently using this code to list all open workbooks within a combobox, but I don't need the source workbook to be listed as well.
Dim wkb as Workbook
With Me.ComboBox1
For each wkb In ...
2
votes
1
answer
71
views
Powershell move folders with exclude
I have a lots of folders with contents that I want to move to another folder
Below I want to move the 3 folders to the ARKIV folder - it works but the script crasches at the end. Am I using the ...
0
votes
1
answer
31
views
How to integrate except: raise with sqlalchemy's exceptions? SQLAlchemyError not working
I have the session rollback whenever I try to execute the statement in main.py. In db_commands.py I have the except: raise clause that should allow me to catch any errors that caused the rollback, e.g....
-1
votes
3
answers
73
views
Why are my try and except clauses not working?
#I will write a program to spurt out objects of a list
import sys
list=[]
for i in range(0,len(list)-1):
try:
print(list[i]+',',end=' ')
except IndexError:
sys.exit()
print(&...
0
votes
0
answers
16
views
convert values float to percentage keep the string values pythoon [duplicate]
I try to convert just the float values to percentages and keep the *- values without change
[data['NPS'] = np.where(( data['Total']<= 3 ) , "*_", df['NPS'])][1]
I try enter image ...
1
vote
0
answers
14
views
Exception on python code on pi doesn't work with threads
I am trying to create an server where you can put on an led remotly and with a button on a pi. the code is working fine but I get an warning that the threads don't close properly and I think the ...
-1
votes
1
answer
86
views
How do I make a Python unit test that fails when an exception is handled?
I am trying to make a Python unit test that will pass if no exceptions are raised and fail if any are (even if they are handled).
My code is basically like this:
def do_something():
try:
# ...
0
votes
0
answers
12
views
using try except with itk on OTB
I want to extract ROI of Sentinel 2 images, several of them aren't on my ROI. I have treatment to do afterwards in the same loop; for it to be faster I'd like to pass to another image if the error :
...
0
votes
0
answers
6
views
CRM Upsert except if modified by non integration user
Is there a way to not update a record if it's been modified by a regular user?
Tried Adding a join to the user table with a unique Id is null because I am trying to update all records that are svc ...
2
votes
4
answers
111
views
Query to find difference between today and yesterday's data along with a pseudo column
There is a table that stores account data for everyday. I want to find out the difference in data between today and yesterday. The query for table creation and insert statements are below :
CREATE ...
0
votes
3
answers
54
views
How to handle chained errors?
I'm running this code which calls yFinance:
try:
allocation['Price_Data_Cut'], allocation['Price_Current'], allocation['Ticker_CHK'] = zip(*allocation['ETF'].\
apply(ticker_info, 1, args = ...
0
votes
3
answers
103
views
Python using the try and except keywords for returning directory errors
In the Python code below, I created a function and pass a parameter called the dir which stands for the directory. After that, I used the try and except statements, when the function runs the try ...
0
votes
2
answers
76
views
How can I implement retry logic in Python's try-except block when input is incorrect
I want x = False after any correct input (0 <= x <= 1). Whenever I have a correct input, the code will keep running, even though it shouldn't.
x = True
while x == True:
score = input("...
-2
votes
1
answer
211
views
How to create a simple login authentication?
How to create a simple login authentication?
These are my questions:
LOGIN AUTHENTICATION AND ACCESS CONTROL MODULE.
Expand your system with user login and password authentication, the system should ...
-1
votes
1
answer
190
views
name is not defined in def
def get_token():
token_request = requests.post(...)
if token_request.status_code == 200:
print('get token = OK')
else:
print('get token = ERROR', token_request.status_code, ...
0
votes
0
answers
55
views
except KeyError as err:
Running the following code:
import re # Biblioteca que trabalha com regular expressions
#Fefininindo areas de categorias
areas = [
'Adriana','Aldenir','Bianca','Caroline','Douglas','Jamila','...
-1
votes
1
answer
48
views
Python except not working when the file is executed in win cmd
can you please help me with finding an answer why except does not work in the below code when executing python script in CMD? Instead of printing defined error message, I receive standard error ...
0
votes
1
answer
305
views
Spotipy exception
I have recently been working on a project with spotify API. I am new to relatively programming, so I'm not too sure what to do with this exception. In my program, when you paste a private spotify ...
0
votes
0
answers
477
views
How to add tag to singular test in dbt
I have several singular tests (my own written except_<model_name>_test.sql SQL files) which are testing EXCEPT statement between source and target tables:
select src.* from src
EXCEPT
select tgt....
0
votes
0
answers
22
views
can I set reconnection after the connection recover in Python urllib
the response is fine when internet connection successed.
sometimes getting internet connection failed, and I want to reconnect 3 times every 5 seconds.
headers = {
'User-Agent': 'Mozilla/5.0 (...
0
votes
0
answers
112
views
best practice and utility in python exceptions
Firstly, I have found this piece of code
try:
iter(iterable)
except Exception as error:
raise error
I am currently startingt to learn python but, that code is the same as if it wasn't ...
-1
votes
2
answers
67
views
Use JavaScript to replace all characters in string with "p" except "o"
I would like to replace all characters in a string myString with "p", except "o".
For example:
"fgyerfgehooefwfweeo"
should become
"pppppppppoopppppppo"
I ...
1
vote
1
answer
31
views
KeyboardInterrupt handeling with sys.exit() not working on pyCharm
I am a beginner python learner, and i am learning from a book a small animated project called ZigZag.
IDE is Pycharm and i am using Try and Except KeyboardInterrupt and the code for the Except clause ...
1
vote
1
answer
53
views
Catch all errors when trying to open a txt file
I'd like to catch all errors when trying to open a txt file that doesn't even exist.
This is my code block:
def read_credentials(filename):
try:
with open(txt_file) as file:
lines =...
0
votes
0
answers
39
views
try except AttributeError bugs
I'm trying to add try and except to my code but it does not work.
def _get_table_df(self, table):
l = module.send_command(name='Read', attributes={'type': table, 'method':'all', 'limit':'...
0
votes
0
answers
38
views
KeyboardInterrupt is not throwing the except clause when CRTL+C is pressed
I am implementing a socket server in python. Everything works well except KeyboardInterrupt does not stop my server in the terminal. Any ideas? Thank a lot!
def run(self) -> None:
try:
...
1
vote
1
answer
124
views
How to monitor internet connectivity using infinite while loop Python?
I am using an infinite while loop to perform specific function if internet is available. And to print an statement if internet is not available. Following is the code.
import requests,time
while True:
...
-3
votes
1
answer
35
views
What is the use of try and except inside a function in python? [duplicate]
I want to know how to use try and except inside a function and what change will it bring to my syntax of code.
I was trying to use this tags inside one function but error was coming and my program was ...
0
votes
1
answer
92
views
Usage of EXCEPT keyword in subquery
I have to identify a set of lines to be deleted from a table and here is the logic I used to determine the scope to be deleted.
I have 2 tables AAA and BBB using Sybase ASE.
AAA has 2 columns : a date,...
0
votes
1
answer
48
views
INSERT... SELECT... EXCEPT
I am trying to combine two tables. So I would like to add the rows from table_2 into table_1 if the column_2 value not already exist in a row (also column_2) of table 1.
Something like:
INSERT INTO ...
0
votes
0
answers
27
views
TRY and EXCEPT problem in a collatz conjecture
Here Is The Code
What I Get After The Execution Of The Code
Why is the programm printing number instead of using it as an argument in the collatz() function?
0
votes
3
answers
188
views
Except a generic list with another generic list without applying distinct operation
In the following code, I expect the result has 2 elements with same values("Item1","Item1") but the result has 1 element("Item1"):
var list = new List<string>(){&...
-1
votes
2
answers
45
views
How do I create a function/method out of this code and then call it to the main()?
enter code hereThis is the original code that I wrote:
while True:
user_input = (input(">>",))
try:
user_input = int(user_input)
except ValueError:
pass
...
0
votes
0
answers
48
views
try except not passing
stack = []
try:
top = stack.pop()
except IndexError:
pass
Error: IndexError: pop from empty list
I want the try except statement to pass if the stack can't be popped, but an error is still ...
1
vote
2
answers
126
views
How to find the difference between two dictionaries (key and value) in LINQ
I have 2 dictionaries.
One of which reports the added widgets (currentStatus), and the other is the default one (defaultDashboardWidgets)
private readonly Dictionary<string, int> ...
0
votes
1
answer
1k
views
FastAPI FileResponse not entering the except block
Good afternoon friends.
I am having issues with FastApi's FileResponse and catching FileNotFoundError (or any, really) exceptions.
Here's my script:
import os
import sys
from fastapi import FastAPI, ...
0
votes
1
answer
17
views
Try and Except issue with range
My error handling is stuck, I keep getting the error that unindented amount does not match.
def landing():
try:
print("1) Create a new member")
print("2) Check for ...
0
votes
1
answer
190
views
Copy everything except specific files
How can I copy everything (files and directories(even if they are empty)) from one directory to another, except files ".php", and files with name "config.yml".
I need to do this ...
1
vote
1
answer
103
views
Distinct Values in hashsets and insert in DataGridView
I want to display a hashset with all the different values between two DataGridView, but I have not been successful in displaying the strings, I attach images.
var dataA = new HashSet<string>();...
-1
votes
2
answers
94
views
Get all invalid from a list LINQ
I have two lists that I have a property that I want to compare on. Based on this property, I want to return all the elements from list1 that is not in list2.
List1: {Name, Age, Id}
{John, 10, 1},
{Joe,...
2
votes
2
answers
366
views
'except' in try statement (inside while loop) isn't working
I've written a program which repeatedly reads numbers until the
user enters "done". If the user enters anything other than a number, detect their mistake using try and except and print an ...
0
votes
1
answer
38
views
how to chose files to read from using nested try except?
Depending on availability, I am trying to define a priority order of files to read from. I used nested Try Except and it works as expected. However, it's pretty cumbersome.
try :
data_bachir = pd....
0
votes
1
answer
165
views
The Python-Validating Sharepoint file has been uploaded
I'm uploading a file to SharePoint with a hyperlink to that file in my email to stakeholders. I need my Python code to validate that the file has actually been saved to the SharePoint location before ...
0
votes
2
answers
57
views
While loops asking for correct imput
I'm new to python and I'm looking to code a small calculator for divisions, that includes while loops and if conditionals
My code looks like this:
a = input('first number')
while type(a)!=int:
...
3
votes
1
answer
558
views
Try and Except in Pandas operations - how to do it?
So I wrote a code that divides a column by another column:
df['division'] = df['numerator']/df['denominator']
But since the 'denominator' is a result of other calculations, sometimes it is equal to 0....
0
votes
0
answers
67
views
Excepting errors dont except and only summon new erros
Im tryina to except the error
File ".py", line 656, in raise_transaction_not_found
raise TransactionNotFound(message)
web3.exceptions.TransactionNotFound: Transaction with hash: '...
0
votes
1
answer
192
views
How to cast the object type in List<t>.Except
I made two simple classes for user and users, in class user I only have userID, userName and List<string> userGroup, and in class users I have the member for two user and two properties to ...
0
votes
0
answers
60
views
JS Extract one range from another
I need ready to use code on JS as I find it really hard to write it myself. Basically I have two arrays of with ranges (A and B) and I need to subtract ranges in array B from ranges in array A.
...