Visualize dataframes in 2 lines

2020-08-22 Thread Dave Dawson
import sho
sho.w(dataframe)



Install : pip install sho
Medium Article: 
https://medium.com/@davewd/sho-w-dataframe-my-first-package-b7242088b78f
Github: https://github.com/davewd/sho
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Embedded python: How to debug code in an isolated way

2020-08-22 Thread Eko palypse
Thx for your tip/suggestion.

> If In Doubt, Print It Out!

That's the current situation and that's usually enough, but then there's
this situation
where it gets annoying because you realize that the print wouldn't make
more sense at this point
but at that point and that's where a debugger is just nicer, I think.

Eren

Am Sa., 22. Aug. 2020 um 22:59 Uhr schrieb Chris Angelico :

> On Sun, Aug 23, 2020 at 5:51 AM Eko palypse  wrote:
> > So the question is, what do I need to read/learn/understand in order to
> solve this issue?
> > Or in other words, how can I debug my script in an isolated environment.
>
> I'd go for the old standby - IIDPIO: If In Doubt, Print It Out!
> Instead of trying to use a debug harness, just run your code normally,
> and print out whatever you think might be of interest. If you don't
> have a console, well, that would be the first thing to do - you
> *always* need a console.
>
> ChrisA
> --
> https://mail.python.org/mailman/listinfo/python-list
>
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Embedded python: How to debug code in an isolated way

2020-08-22 Thread Chris Angelico
On Sun, Aug 23, 2020 at 5:51 AM Eko palypse  wrote:
> So the question is, what do I need to read/learn/understand in order to solve 
> this issue?
> Or in other words, how can I debug my script in an isolated environment.

I'd go for the old standby - IIDPIO: If In Doubt, Print It Out!
Instead of trying to use a debug harness, just run your code normally,
and print out whatever you think might be of interest. If you don't
have a console, well, that would be the first thing to do - you
*always* need a console.

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list


Embedded python: How to debug code in an isolated way

2020-08-22 Thread Eko palypse
Hello,

background info first. On windows, python3.8.5

A cpp app has an embedded python interpreter which allows to modify/enhance the 
cpp app
by providing objects to manipulate the cpp app and callbacks to act on certain 
events, 
like fileopen, fileclose, updateui ... which are send by the cpp app.
The embedded python interpreter acts more or less like the standard python REPL.
If you run a script with code like

def test(i):
print(i*2)

test(4)

then the test function is now globally available as long as the cpp app is 
alive.

I've written a debugger based on bdb and encountered a situation which I 
haven't found out how to handle correctly yet.

Let's assume I've registered a callback when something changes in the UI.
In that case an object function gets called which highlights certain aspects in 
the UI.

Now if I run a script via this debugger it works as long as I don't use the 
same object function.
If I do use it, then the stack gets corrupted(?).

For example it look like this

stack:
, 580
', line 1, code >, 1
>, 8

now if I enter the function which call this object function this gets add

, 5

I step through the code and suddenly the stack looks like this

, 580
', line 1, code >, 1
>, 8
>, 154
, 102)]

EnhanceAnyLexer is neither part of the test_pydebugger script nor part of the 
debugger.
It is used to register a callback on the updateui event.

So the question is, what do I need to read/learn/understand in order to solve 
this issue?
Or in other words, how can I debug my script in an isolated environment.
I can't manipulate the __main__.dict as this seems to have general impact on 
registered callbacks as well.
Any ideas?

Thank you
Eren
-- 
https://mail.python.org/mailman/listinfo/python-list


RE: How do I use the data entered in a form?

2020-08-22 Thread Peter Otten
Steve wrote:

> I take it that "fetch" is not an inside command or reserved word.  The
> code is everything what was posted.

You don't say where you "found" the code. If you took it from 

https://www.python-course.eu/tkinter_entry_widgets.php

you need to take another look. A fetch() function is provided.

> The system reports that "SR is not defined" at the end of the file.

After you applied the changes I suggested?

-- 
https://mail.python.org/mailman/listinfo/python-list


RE: How do I use the data entered in a form?

2020-08-22 Thread Steve


The only thing I can add to that program as far as errors go is that "SR is
Not Defined" after the program focus is outside of any def in the last line
or two.  Is there any location where I should place "return (SR)" or a
"global SR"?

I take it that "fetch" is not an inside command or reserved word.  The code
is everything what was posted.  Nothing was indicated in the comments that
any code or def was missing.
I commented it out because it was causing the program to dump out preventing
me from exploring the error or developing code for other purposes. Maybe I
don't need it.

Still the value for SR does not seem to be visible outside any of the def
calls. The system reports that "SR is not defined" at the end of the file.

=
Footnote:
If you double major in psychology and reverse psychology, to they cacel each
other out?

-Original Message-
From: Python-list  On
Behalf Of Peter Otten
Sent: Saturday, August 22, 2020 2:26 AM
To: python-list@python.org
Subject: Re: How do I use the data entered in a form?

Steve wrote:

> def makeform(root, fields):
>entries = {}
>for field in fields:
...
>return entries
> 
> if __name__ == '__main__':
>root = Tk()
>ents = makeform(root, fields)

> 
> SR = (entries['Sensor_Reading'].get()) print ("SR Outside = " + SR)
> 
> ==
> The last two lines were guesses but they still failed.

[Always tell us how your code fails, please. If there's an exception include
it and the complete traceback in your post.]

In this case you probably get a NameError because 'entries' is a local
variable in makeform(). In the global namespace the person you copied the
code from used 'ents' -- so you have to either use ents, too,

> if __name__ == '__main__':
>root = Tk()
 ents = makeform(root, fields)
 ...
 SR = ents['Sensor_Reading'].get()


or rename it

> if __name__ == '__main__':
>root = Tk()
 entries = makeform(root, fields)
 ...
 SR = entries['Sensor_Reading'].get()

>  # root.bind('', (lambda event, e = ents: fetch(e)))
>   #"fetch not defined" reported here

Again, the author of the original code probably defined a fetch() function;
if you want to use it you have to copy it into your script.


--
https://mail.python.org/mailman/listinfo/python-list

-- 
https://mail.python.org/mailman/listinfo/python-list