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

This tag is used for two different things:

  1. The Microsoft [.NET] Framework [LINQ] Except() method which produces set differences of two sequences.

  2. The [Python] keyword except used for exception handling.

Please use the tag for questions related to the SQL operator EXCEPT

598 questions
-2
votes
1 answer

Which is a better solution? (exception handling)

Where should I put the Exception handling? which one is the best solution for the code: def spam(divideBy): try: return 42 / divideBy except ZeroDivisionError: print('Error: Invalid…
sf31
  • 45
  • 3
  • 10
-2
votes
2 answers

Alternate of except in sql

I want to use alternate of except. I used left join but its not bringing the required column data. SELECT ACCOUNT_NO, BILL_CYCLE_DATE, 2 FROM CSS_BILL_Job WHERE (BILL_CYCLE_DATE = 20190526 OR BILL_CYCLE_DATE = 20190525) --33612 EXCEPT SELECT…
nick
  • 323
  • 2
  • 14
-2
votes
5 answers

SQL Query Except then select TOP 10

I have the following query where I EXCEPT two results in Microsoft SQL Server SELECT * FROM News INNER JOIN NewsAssignment on News.Id = NewsAssignment.NewsId INNER JOIN NewsAudience on NewsAssignment.NewsAudienceId = NewsAudience.Id WHERE…
FerronSW
  • 505
  • 4
  • 18
-2
votes
3 answers

try - except struggle

I am trying to stop this program if the number the person enters is not 4 numbers long, using the try-except structure. I don't really get why it skips the except block if I enter a 2 or 3 digit number for example. All help appreciated. guess =…
robbah
  • 43
  • 6
-2
votes
1 answer

SyntaxError when trying to handle errors with except

I'm trying to program a personal assistant for my ICT class. I'm a beginner in python and I tried following a tutorial but I get a SyntaxError when using except. This is the script: try: command = r.recognize_google(audio) print ('Your…
-2
votes
1 answer

Linux crontab script log into a local user in ssh

At work on a Linux server, I try to find a way to execute a script by crontab(in root) for: Log into a local user by ssh with the command ssh -X user@localhost answer at the password question for the user execute a command wait the end exit ssh…
shinji7800
  • 53
  • 6
-2
votes
1 answer

Compare 2 string List by the first word up to a control character

Is it possible to compare 2 string List by the first word up to a control character ? Say the string is - "yellow/tall/wide/white" Is there away of using - newList = listOne.Except( listTwo ).ToList(); But only comparing up to the first '/' Thanks.
Kevin Griffiths
  • 161
  • 2
  • 12
-2
votes
1 answer

Use 'try', 'raise', 'except' function to write a short program

Consider a Circle class used to represent circle objects. Instances of the Circle class will have an attribute called radius which indicates the size of the circle. The constructor method (e.g. init) for this class will initialise this attribute…
-2
votes
1 answer

python -- Cannot update list in recursive

I used recursive to get combination of certain elements. I get combination when indexerror occurs.(in except: part) For a = ['a1', 'a2', 'a3'], b = ['b1', 'b2'], c = ['c1', 'c2', 'c3'] I want to get possible combinations which are [['a1', 'b1',…
chacha
  • 1
  • 1
-2
votes
1 answer

Fastest way or alternative way of counting elements in a enumerable of custom type in C#

I am doing an except of two DataTables in c#. I've overloaded the IEqualityComparer public bool Equals(T sourceRec, T targetRec) { string srcHash, tgtHash; srcHash = HashGenerator.GenerateHash(sourceRec); tgtHash =…
-2
votes
1 answer

Difference between expect without specifier vs else?

In Python's try, except blocks, why does else need to exist if I can just use an except: without a specifier?
gunit
  • 3,700
  • 4
  • 31
  • 42
-2
votes
1 answer

Raise an Exception on User Input

I'm trying to grasp my head around try/except. Please see code below.... status = raw_input('What is your status?') #if x is anything other othan "citizen", "legal", or "illegal" raise a ValueError try: status == "citizen" or status ==…
MJ_49
  • 21
  • 1
  • 3
-2
votes
2 answers

Mysql: Delete from table where ID, except rows in a selection?

The problem I'm using buddypress for Wordpress it has a table for private messages in side which are thread ids for message threads. Currently there's no limit on how many messages can be in a thread. I want to create a command that deletes all but…
shakespeare
  • 89
  • 1
  • 7
-2
votes
1 answer

Having trouble requesting input in python

i have troubling handling input in python. I have a program that request from the user the number of recommendations to be calculated.He can enter any positive integer and blank(""). I tried using the "try: , except: " commands,but then i leave out…
Nick
  • 825
  • 1
  • 8
  • 20
-2
votes
3 answers

finding key in dict using try except

My function is: def searchstock(): dictionary=calcreturn(dictionize(tickers(openfile()),pairslist())) inp=raw_input("What is the stock ticker? ") while True: try: dictionary[inp] break except KeyError: …
1 2 3
39
40