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
565
questions
0
votes
1
answer
32
views
SQL query for EXCEPT or NOT IN
I'm new to SQL and I am trying to write a query on PostgreSQL to find the cust_ID and customer name of each customer at the bank who only has a loan at the bank, and no account.
The database schema is:...
-1
votes
0
answers
26
views
Python except ConnectionArbortedError doesn't prevent error
I have a try except clause in my python server thread, where one of the except conditions is "ConnectionAbortedEror" because every time I close the client that's connecting to the server it ...
-1
votes
1
answer
23
views
Change the key in a dataframe dict
Hi all I have a DataFrame variables that I create from an xml file that is:
iva = df['p:FatturaElettronica']['FatturaElettronicaHeader']['CessionarioCommittente']['DatiAnagrafici']['IdFiscaleIVA']['...
-1
votes
1
answer
66
views
LINQ Except not returning string values correctly
I've been trying to create a small program to compare two collections of strings and to output any items that are different or missing between collection1 and collection2.
As far as I have been able ...
-2
votes
1
answer
44
views
python : my try except doesnt catch my keyboardinterrupt [closed]
I have this call in python that excecutes a sh script.
subprocess.check_call(f'./compose/auto_deploy_do_{name}.sh', stdout=sys.stdout, stderr=subprocess.STDOUT)
This sh script launches rsync and when ...
0
votes
0
answers
10
views
Except python does not catch Windows error FileNotFoundError | "The system cannot find the specified path." [duplicate]
The fact is that I want to make it so that if there is no folder, then it was created by itself.
but except does not catch this error at all with either "Windows Error" or with "OS ...
-2
votes
5
answers
42
views
Is it possible to use the "try" Function on an "if" statement?
In my program I have this 2D array:
Test=[
["TestName", "123", "1", "2.5"],
["NameTest", "321", "10", "5.2"],
[&...
0
votes
1
answer
46
views
Why does BeautifulSoup.find not work when using a for loop?
I am iterating through a list of URL's to extract 5 items from each URL using BeautifulSoup.find. The list contains about 2000 URL's. Because not every webpage is guaranteed to have all 5 items, I ...
0
votes
0
answers
26
views
Is it okay to leave except EMPTY, when I print out trackback anyway? [Python 3.10]
I understand that it's usually not a good idea to leave "except" empty as errors will go unnoticed.
For example:
def test4():
try:
0/0
except:
pass
print('PROGRAM ...
0
votes
1
answer
30
views
How can I use xpath not operator in APPIUM
I tested these two XPath expressions:
//*[not(@class='android.view.ViewGroup[2]')]
and
//*[not(contains(@class,'android.view.ViewGroup[2]'))]
But that syntax doesn't work. I want to filter ...
0
votes
0
answers
27
views
Find difference between two table in SQL and append back result to source table with extra column
Please pour in your suggestions for the following SQL problem.
I have 2 tables. Table A & B.
Table A
| PID | ReleaseDate |RetiredDate
| -------- | -------------- |
| loc1 | 2021 ...
0
votes
0
answers
24
views
Exceptions: trying multiple statements passing on a success, one except
I am using python and trying to take an object whether as a standard datetime object or as a string and return a string. The returned string doesn't matter here. What matters is that what I want to ...
0
votes
0
answers
28
views
Force exception when testing if hashlib is supported
So got stuck when trying to understand how I can force my test to go to throw a exception in this case. I have a function just testing if the library hashlib is supported or not when running on a ...
0
votes
1
answer
37
views
My Second to Days, Hours, Minutes, Seconds calculator has couple issues
So I am Trying to make a calculator that can show how much days, hours, minutes, and seconds the input seconds are. And I wanted to hide the 0s in eg)0 days, 0 hours, 2 minutes, 23 seconds
I could ...
2
votes
1
answer
73
views
Cannot Cast float to int in Error Handling/Validation Function
I have a function to validate some user input (val) that begins as string input. I want the input to end up in integer format but I don't want to strip a number like 4.2 to make it 4. Instead, I want ...
0
votes
0
answers
24
views
Counting and Error Handling Block Guessing Game
Could you, please, help me to understand how should I use try/except block and count tries at the same time.
Here is the code without try/except block (it seems it's working fine):
import random
...
-1
votes
1
answer
57
views
How to handle Index Error in Tuple Exception in Python?
So I have the follwowing Code:
try:
pygame.mixer.music.load(songs[index])
pygame.mixer.music.play()
check_event()
except:
("IndexError: tuple index out of range")
...
0
votes
2
answers
39
views
Bypassing ValueError in a for loop in python
def decade_total_count(decade, name):
"""
sums up the number of births of the given
female baby `name` in a 10-year period
Parameters:
~~~~~~~~~~~~~~~~~~~~~~~~~...
-2
votes
1
answer
31
views
Is it possible to catch None in except statement?
I'm working on a program that represents a month in number.
Each month name and number are stored in a dictionary, with the key being the month name.
The program needs to take the month name as input ...
0
votes
0
answers
19
views
How to raise an error many times in a loop? [duplicate]
I started to write a program asking an input (integer). I would like to raise two kinds of exceptions : first, in case of numbers are out of range and second, in case of inserted data is not an ...
0
votes
0
answers
18
views
How to calculate column mix with except a value in the same column in Power BI?
I have a table I am trying to calculate Velocity mix without Velocity_WD = blank.
Currently the table looks like this:
However, I want to exclude blank for Velocity_WD and keep the same percentages. ...
0
votes
2
answers
40
views
A Python try/except function to rule them all (with different inputs) is possibile?
I'm trying to define in Python a try/except function that can handle various other function.
The idea is quite this one:
def func1(x,y):
z = x+y
return z
def error_check(func1):
try: ...
-7
votes
1
answer
53
views
Is it possible to avoid integers,floats and special characters using try-except statement only?
I'm trying to make a code that allows only letters. I know we can do this using isalpha() method. But, I'm looking for any other different solutions something like try-except?
1
vote
2
answers
164
views
Linq Except not giving desired results in C#, datatable
I have two DataTables. I applied the Except operator as follows,
and got either unfiltered or undesired results.
resultDataTable = dtA.AsEnumerable().Except(dtB.AsEnumerable()).CopyToDataTable();
...
-1
votes
1
answer
140
views
Getmem (out of memory)
I'm translating codes from C++ source code to delphi language. There is a partition allocated to memory in C++ source code and when I allocate the same partition in delphi I get an error. Where am I ...
0
votes
1
answer
52
views
Row count discrepancy between Intersect and Except queries
I'm getting some strange behaviour using intersect and except. Tb1 has the least rows out of the two tables, and the difference in row count between tb1 and the intersect query results is 143 (...
-1
votes
2
answers
50
views
Python exception handling ValueError
Why does the except ValueError as ve block does not get executed , when I pass a character?
class Division :
def divide(numerator, denominator):
try:
print(f"Result : {(...
0
votes
2
answers
27
views
SQL to find where not exists on one table
I want to find the list of any COMPANYID/USERID combos on the USERS table that does NOT have at least 1 ACCOUNT found on the ACCOUNT table.
In the example below, ABC/USER3 is the only combo that fits ...
1
vote
0
answers
9
views
Try and except exit error after executing the except line
I am trying to exit out of the program after executing the except line. I have tried sys.exit(1) but it is not working. I am opening an .txt file and and passing it through the code. The code works ...
-1
votes
1
answer
83
views
Find List of string in List of strings simplify like in SQL
I am trying to figure out how can I able to find my list of strings in the list of strings.
I found other solutions but most of them are finding only a single word in a string list, but mine is ...
0
votes
5
answers
49
views
Making a program than would ask the user for an integer then will asked if they wish to loop or quit
def interact():
while True:
try:
num = int(input("Please input an integer: "))
if (num % 2) == 0:
print ("{0} is even".format(...
0
votes
2
answers
39
views
it doesn't loop but just breaks even if i input Y
def interact():
while True:
try:
num = int(input("Please input an integer: "))
if (num % 2) == 0:
print ("{0} is even".format(...
0
votes
0
answers
16
views
How can I make the else statement link to except statement [duplicate]
This is my first post on here are, I looked around but couldn't find the answer.
I am new to Python Coding about 2 weeks in, through school.
I am very unsure as to what is wrong with this.
I'm trying ...
-4
votes
1
answer
49
views
what is an exception handler for
I have a script which wants to load integers from a text file. If the file does not exist I want the user to be able to browse for a different file (or the same file in a different location, I have UI ...
0
votes
0
answers
41
views
Im trying to prevent getting expected errors but "try-except" stopped working
I really don't know whats happening.
Yesterday i wrote the 800th line for my project and everything gone perfect.
Every "Try: - except:" i had written yesterday, and test it thousand times, ...
0
votes
0
answers
15
views
Try Except within a for loop
I'm trying to make Python raise my own exception (DateError) when one of the entries in a list isn't an integer, but for some reason Python raises both my DateError and the ValueError that is supposed ...
-1
votes
1
answer
164
views
Compare local and remote files using WinSCP .NET assembly
I'm trying to implement some logic to compare file information between remote server and local server.
I need to compare the file name between local folder and remote folder and download only the new ...
-1
votes
1
answer
126
views
troubles with exceptions in python Codio exercise
I have the following code that also calls the function below.
it loads files which can have text like that
sample 1 (it should return corrupted file)
101 90 20,
abracadabra 45 30
sample 2 (in this ...
0
votes
0
answers
92
views
How to read what's inside a specific memory address to debug crashes of a software?
I am trying to debug a 2009 made game file that randomly crashes without no error or anything other than 0xblabla at game.exe 0x00000005: unable to read at 0xblabla
So I want to see what's inside that ...
0
votes
1
answer
89
views
something is going wrong when using 'try & except' in PYCHARM . 'except' is not workig. it give me 'f is not definded'
try:
f = open("demofile.txt")
f.write("Lorum Ipsum")
except:
print("Something went wrong when writing to the file")
finally:
f.close()
0
votes
0
answers
57
views
Ape tries to make password generator: "if statement" and "try & except" functions prove too difficult (Python) [duplicate]
Basically, I'm attempting to make a password generator. I wanted to make it a bit higher quality than what some of the tutorials I watched suggested, so I tried to allow some user input; I wanted the ...
-1
votes
1
answer
1k
views
What's wrong with " except Exception as e"
I got the following error for my code.
Can anyone help me pls.
code is as follows
def askforinteger():
while True:
try:
a = int(input("enter an integer")
...
0
votes
1
answer
90
views
IEnumerable.Except() on LINQ doesn't run between ideal source and target lists
I start my question by mentioning this first - I have gone through the other SO questions and did end up into a situation/problem which I could not find myself an answer. So if there is, please point ...
0
votes
0
answers
23
views
Except script inside shell script closing ssh after it ends
I need to execute some tasks inside a ssh. I built a simple script where I start an ssh session in a terminal and I need ssh to stay open after finishing my script.
#!/bin/bash
gnome-terminal -e &...
0
votes
0
answers
491
views
SyntaxError: default 'except:' must be last
I copied and pasted the first half (the variables with the 1 on the end) and pasted it underneath but changed 1 to 2. The first half (the 1) works, but right at the end of the second one it gives me ...
2
votes
2
answers
871
views
Not allowing spaces in string input Python
I am trying to not allow any strings whatsoever in the inputted string. I've tried using len strip to try and count the whitespaces and no allowing it but it seems to only count the initial ...
1
vote
1
answer
128
views
KeyboardInterrupt exeption handling with time.sleep
I am going to display current time every 2 seconds and exception handling.
If there is KeyboardInterrupt, message should display like print('Program is stopped').
But in my code, try/except isn`t ...
0
votes
0
answers
38
views
How to modify code for exceptions and prevent termination?
I am facing an issue with the following code. I try to scrape a bundle of pages which regularly have the same structure but sometimes exceptions occure and I am struggling how to consider it in the ...
0
votes
3
answers
118
views
try except if two inputs are the same
I currently have a while loop that looks like this:
while True:
try:
entry1 = input("input the first number")
entry2 = input("enter the second number")
...