So I'm assuming here that fp(x) or f(x) are functions that don't return anything.

Take a look at this,

def fp(x):
    print(x)

print(fp(10))

You might think that the output of this would be 10 but you get this,

10
None

Take a look at this function,

def fp():
    pass
print(fp())

Output:

None

Functions by default return a None type. So in your case when you are doing abs(fp(x)) the problem seems to be that you are doing abs() on None that's why you get the error.

Look at this,

def fp():
        pass
abs(fp())

Output:

TypeError: bad operand type for abs(): 'NoneType' python error

So add a return statement to the function and you can see the error will be gone

def fp(x):
    return x
some_value = abs(fp(-10.5))
print(some_value)

Output:

10.5

Now the error is gone.

Answer from void on Stack Overflow
Discussions

API Integration - TypeError: bad operand type for abs(): 'NoneType'
Hi all, We are trying to submit sales orders programmatically with as few properties as possible to decrease our data load. We are running into this error: (most recent call last): File “/home/frappe/benches/bench-version-12-2020-09-25/apps/frappe/frappe/app.py”, line 64, in application ... More on discuss.frappe.io
🌐 discuss.frappe.io
1
0
June 21, 2020
Python absolute value
hello, I am trying to get rid off the absolute value, but I don’t understand why I am getting error xVal = IN[0] xout= for x in xVal: b = abs(x): if b More on forum.dynamobim.com
🌐 forum.dynamobim.com
1
0
June 6, 2019
Erreur : bad operand type for abs(): sur creation de Sales Order
Bonsoir, Sur une première création de Sales Order par REST API (sur une installation qui fonctionne déjà en direct), j’ai une erreur têtue L’appel API : URL = string(52) "https://-----.dokos.cloud/api/resource/Sales O… More on community.dokos.io
🌐 community.dokos.io
0
0
January 24, 2022
'Bad operand type for abs', how do i solve this
def checkio(numbersarray: tuple) -> list: result = sorted([numbersarray], key=lambda x:abs(x)) return result More on py.checkio.org
🌐 py.checkio.org
🌐
Mozilla Discourse
discourse.mozilla.org › t › synthetic-test-sentence-typeerror-bad-operand-type-for-abs-nonetype-error › 56559
Synthetic test sentence TypeError: bad operand type for abs(): 'NoneType' error - TTS (Text-to-Speech) - Mozilla Discourse
March 25, 2020 - I’m training with the LJSpeech dataset and after about the 50th epoch I get the following error when it tries to generate the test sentences. File "train.py", line 502, in evaluate ap.save_wav(wav, file_path) File "/home/username/Audio/TTS/tts_namespace/TTS/utils/audio.py", line 58, in save_wav wav_norm = wav * (32767 / max(0.01, np.max(np.abs(wav)))) TypeError: bad operand type for abs(): 'NoneType' Traceback (most recent call last): File "train.py", line 502, in evaluate ap.save_wav(wav, file...
🌐
Python Examples
pythonexamples.org › python-absolute-value-abs
abs() - Python Examples
If we provide an argument of any non-numeric type like string, abs() function raises TypeError.
🌐
Dynamo
forum.dynamobim.com › revit
Python absolute value - Revit - Dynamo
June 6, 2019 - hello, I am trying to get rid off the absolute value, but I don’t understand why I am getting error xVal = IN[0] xout= for x in xVal: b = abs(x): if b<150: xout.append("Less than 150 Pipe is " + str(b)) else: x…
🌐
dokos community
community.dokos.io › 🕹 aide utilisation
Erreur : bad operand type for abs(): sur creation de Sales Order - 🕹 Aide utilisation - dokos community
January 24, 2022 - Bonsoir, Sur une première création de Sales Order par REST API (sur une installation qui fonctionne déjà en direct), j’ai une erreur têtue L’appel API : URL = string(52) "https://-----.dokos.cloud/api/resource/Sales Order" method POST / action resource/Sales Order ok data Array ( [item] => Array ( [name] => Le ---- [item_code] => Le ---- [item_name] => Le ----- [delivery_date] => 2022-11-01 [qty] => 1 [item_bo...
🌐
GitHub
github.com › coqui-ai › TTS › discussions › 168
Synthetic test sentence typeerror bad operand type for abs nonetype error · coqui-ai/TTS · Discussion #168
wav = None if use_griffin_lim: print('We are using griffin_lim.') wav = inv_spectrogram(postnet_output, ap, CONFIG) # trim silence if do_trim_silence: wav = trim_silence(wav, ap) print('In utils/synthesis is wav still None: ' + str(wav)) return wav, alignment, decoder_output, postnet_output, stop_tokens Is there somewhere that I need to set use_griffin_lim? config.json maybe? [This is an archived TTS discussion thread from discourse.mozilla.org/t/synthetic-test-sentence-typeerror-bad-operand-type-for-abs-nonetype-error]
Author   coqui-ai
Find elsewhere
🌐
Checkio
py.checkio.org › forum › post › 13102 › bad-operand-type-for-abs-how-do-i-solve-this
'Bad operand type for abs', how do i solve this
def checkio(numbersarray: tuple) -> list: result = sorted([numbersarray], key=lambda x:abs(x)) return result
🌐
GitHub
github.com › tarantool › test-run › issues › 28
TypeError: bad operand type for abs(): 'NoneType' · Issue #28 · tarantool/test-run
May 16, 2016 - --------------------------------------------------------------------------- box-py/args.test.py Traceback (most recent call last): File "/home/travis/build/rtsisyk/tarantool/test-run/lib/test.py", line 120, in run self.execute(server) File "/home/travis/build/rtsisyk/tarantool/test-run/lib/tarantool_server.py", line 124, in execute server.crash_grep() File "/home/travis/build/rtsisyk/tarantool/test-run/lib/tarantool_server.py", line 567, in crash_grep sys.stdout.write('[Signal=%d]\n' % abs(self.process.returncode)) TypeError: bad operand type for abs(): 'NoneType' [ fail ] Test failed!
🌐
Frappe
discuss.frappe.io › install / update
TypeError: unsupported operand type(s) for |: 'type' and 'NoneType' - Install / Update - Frappe Forum
October 9, 2022 - Hello Everyone, I’m facing a problem when updating erpnext bench, Every time i try to update bench keeps on getting this error. erpnext@erpnext-vm-2:/opt/bench/erpnext$ bench update WARN: bench is installed in editabl…
🌐
GitHub
github.com › numpy › numpy › issues › 1784
numpy.ma.abs not working correctly? (Trac #1186) · Issue #1784 · numpy/numpy
October 19, 2012 - Original ticket http://projects.scipy.org/numpy/ticket/1186 on 2009-08-03 by @dalloliogm, assigned to @pierregm. the standard function abs() raises an error when applied to an array/list containing a 'None' value. To circumvent this prob...
Author   thouis
🌐
Trymito
trymito.io › excel-to-python › functions › math › ABS
Excel to Python: ABS Function - A Complete Guide | Mito
If you execute the ABS value function on a cell that contains new data in Excel, it will simply return 0. However, in Pandas, empty cells are represented by the Python NoneType. Using the .abs() function on the NoneType will create this error `TypeError: bad operand type for abs(): 'NoneType'`.
🌐
GitHub
github.com › HIPS › autograd › issues › 102
TypeError: bad operand type for abs(): 'FloatNode' · Issue #102 · HIPS/autograd
April 28, 2016 - --------------------------------------------------------------------------- TypeError Traceback (most recent call last) /home/usman/anaconda2/envs/autograd_py3/lib/python3.5/site-packages/autograd/core.py in forward_pass(fun, args, kwargs, argnum) 30 args[argnum] = merge_tapes(start_node, arg_wrt) ---> 31 try: end_node = fun(*args, **kwargs) 32 except Exception as e: add_extra_error_message(e) <ipython-input-33-eba96aa529af> in packed_loss(x, data) 101 theta = self.__unpack_x(x) --> 102 return self.loss(theta, data) 103 return x_init, theta_init, packed_loss <ipython-input-36-758b87b157e8> in
🌐
GitHub
github.com › powa-team › powa › issues › 61
Unable to view index suggestions - TypeError: bad operand type for abs(): 'NoneType' · Issue #61 · powa-team/powa
April 14, 2015 - Unable to view index suggestions - TypeError: bad operand type for abs(): 'NoneType'#61 · Copy link · ribbles · opened · on Dec 15, 2015 · Issue body actions · Unable to view index suggestions.
Author   ribbles
🌐
n8n
community.n8n.io › questions
ERPnext: TypeError on base_write_off_amount despite providing 0.0 via API - Questions - n8n Community
June 7, 2025 - Error Summary When creating a Purchase Invoice via the API (POST to /api/resource/Purchase Invoice), a TypeError is raised due to base_write_off_amount being treated as None, even though the value 0.0 is explicitly provided. TypeError: unsupported operand type(s) for -: 'NoneType' and 'float' It happens inside: base_grand_total = base_grand_total - flt(self.base_write_off_amount) This line fails because self.base_write_off_amount is still None.
🌐
Seaborn Line Plots
marsja.se › home › programming › python › how to get absolute value in python with abs() and pandas
How to get Absolute Value in Python with abs() and Pandas
May 26, 2024 - If we, however, put in something that is not a number, we will get a TypeError (“bad operand type for abs(): ‘str’”.
🌐
Google Groups
groups.google.com › g › theano-users › c › igX0KiMF0ls
TypeError: bad operand type for abs(): 'list'
July 6, 2016 - For access, try contacting the group's owners and managers If you are subscribed to this group and have noticed abuse, report abusive group.