question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

NameError: name 'METHOD_NCUBED' is not defined

See original GitHub issue

Hello,

I’m not that great with Python, more of a JS dev, so I don’t know if this is correct?

When trying to pass in the parameters method, extmethod without quotes results in error. I suggest a fix.

trendln.plot_support_resistance(
            hist[-1000:].Close, method="METHOD_PROBHOUGH")

Then on lines 950 - 960 of init.py


    if method == "METHOD_NCUBED":
        trendmethod = get_trend
    elif method == "METHOD_NSQUREDLOGN":
        trendmethod = get_trend_opt
    elif method == "METHOD_HOUGHPOINTS":
        trendmethod = houghpt
    # pip install scikit-image
    elif method == "METHOD_HOUGHLINES":
        trendmethod = hough
    elif method == "METHOD_PROBHOUGH":
        trendmethod = prob_hough

Issue Analytics

  • State:open
  • Created 3 years ago
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

4reactions
GregoryMorsecommented, Sep 30, 2020

The correct solution is to either import everything e.g. import trendln and to as suggested use trendln.CONSTANT_NAME syntax or use from trendln import CONSTANT_NAME. It is not necessary for these to be strings. However I will update the examples or look for scenarios where this confusion can come up so it will be corrected in the next version. These are just numeric constants with names provided for convenience. Strings might be okay as performance is not particularly an issue on these parameters but nonetheless, constants seem cleaner.

0reactions
coditoricommented, Sep 29, 2020

@saulable It’s an enum not a string, try this one:

trendln.plot_support_resistance(
            hist[-1000:].Close, method=trendln.METHOD_NCUBED)
Read more comments on GitHub >

github_iconTop Results From Across the Web

How to fix "NameError: name method-name is not defined"?
Just add self. in front of it: self.method1(1). Also change your method signitures to: def method1(self, n):. and def method2(self, n):.
Read more >
Python nameerror name is not defined Solution - Career Karma
A NameError means that you've tried to use a variable that does not yet exist. In this guide, we're going to talk about...
Read more >
Python Errors: Nameerror name is not defined and more
For example, python nameerror name is not defined, what does this mean? You will find out by the end of this tutorial. The...
Read more >
NameError: Name plot_cases_simple is Not Defined
In Python, the NameError occurs when you try to use a variable, function, or module that doesn't exist or wasn't used in a...
Read more >
nameerror name is not defined python 3 - GIS Stack Exchange
Check the alignment within the print_path(begin, end) function (possibly a copy/paste issue, but as it is it will not work).
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found