EuroPython 2019: Warning - Spoiler alert!

2019-06-14 Thread M.-A. Lemburg
Usually, we try to have something as surprise for our attendees every
year. However, for this year’s conference, we have decided to give our
attendees something to play with and this needs a little more
preparation than a bottle or a beach towel.

Drum roll… crowd screaming… and here it is: we’re please to
present the...

EuroPython 2019 PewPew Game Console
---

* https://ep2019.europython.eu/events/pewpew-workshops/ *

The device was created and designed by Radomir Dopieralski, a long
time EuroPython regular and enthusiastic Python device and robotics
builder.

The PewPew is a simplified game console, programmable with
CircuitPython, a variant of MicroPython. It comes with a 64 LED
display and a set of small buttons to drive the console.

We will have one device per attendee with training or conference
ticket and plan to give them out together with the badges.

Free Workshops
--

To teach you how to program the consoles and help with any questions
you may have, we have arranged a special workshop room on the training
days Monday and Tuesday, where Radomir and his team will run workshops
focusing on the PewPew. You will learn how to write small programs and
games.

Our hope is that you will take this knowledge home and spread the word
about how much fun Python is – especially for younger users.

The workshops are free for EuroPython conference or training ticket
holders, but please see our notes on catering on the training days.

Help us run the workshops
-

Since Radomir needs help with running the workshops, we are reaching
out to you with this blog post. If you are interested in embedded
Python, hardware hacking, game development and similar topics, we
invite you to come help us running those workshops.

This is a great opportunity to meet with Python developers and learn
together, and we’re sure you will have great fun while helping other
attendees. Whether it’s just lending a hand getting things working, or
running a whole workshop – it’s up to you, either way we will greatly
appreciate your help.

Please sign up using our mentor form. Many thanks !


https://docs.google.com/forms/d/e/1FAIpQLSefU0VMGA7QVO6DgO_9faHQ_Z4XcsfpRZ2koALOP63kN-UeGA/viewform

More information will be available on the PewPew workshop page:

https://ep2019.europython.eu/events/pewpew-workshops/



Dates and Venues


EuroPython will be held from July 8-14 2019 in Basel, Switzerland, at
the Congress Center Basel (CCB) for the main conference days (Wed-Fri)
and the FHNW Muttenz for the workshops/trainings/sprints days
(Mon-Tue, Sat-Sun).

Tickets can be purchased on our registration page:

https://ep2019.europython.eu/registration/buy-tickets/

For more details, please have a look at our website and the FAQ:

https://ep2019.europython.eu/faq


Help spread the word


Please help us spread this message by sharing it on your social
networks as widely as possible. Thank you !

Link to the blog post:

https://blog.europython.eu/post/185584014022/europython-2019-warning-spoiler-alert

Tweet:

https://twitter.com/europython/status/1139464940627136512


Enjoy,
--
EuroPython 2019 Team
https://ep2019.europython.eu/
https://www.europython-society.org/

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


Re: How control a GUI for an unrelated application from a Python script?

2019-06-14 Thread Thomas Jollans
On 14/06/2019 01.49, Christian Seberino wrote:
> I have a third party GUI that manages some hardware.
>
> I want to control the hardware from a Python script.

Forget about the GUI, see if you can control your device without it.

See how well the device is documented. Maybe there's an API? If not for
Python, maybe for C? If not, maybe it's easy to write your own driver in
Python?

Writing a driver for a simple message-based wire protocol is not very
hard, and may be easier than reliably controlling somebody else's GUI
with a script.


>
> This seems to mean I need to somehow have Python code
>   that imitates a human doing the necessary
> actions on the GUI (selecting menu options, pressing buttons, etc.)
>
> Is this possible / easy / doable?
>
> Thanks!
>
> Chris

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


Re: How control a GUI for an unrelated application from a Python script?

2019-06-14 Thread Chris Hills

On 6/14/2019 12:49 AM, Christian Seberino wrote:

I have a third party GUI that manages some hardware.

I want to control the hardware from a Python script.

This seems to mean I need to somehow have Python code
   that imitates a human doing the necessary
 actions on the GUI (selecting menu options, pressing buttons, etc.)

Is this possible / easy / doable?

Thanks!

Chris



Hi Chris

THere are two approaches for this. If the appication is inheritenty 
controllable, e.g. through COM, then you can use win32com.


Alternatively, you can go down the route of "Robotic Process Automation" 
using something like https://github.com/OakwoodAI/Automagica


Hope this helps,

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


Re: can not use pycharm

2019-06-14 Thread Johann Spies
On Mon, 10 Jun 2019 at 19:46, aris  wrote:

>
>
> Hello,this is my first time trying to learn coding and programming and I
> wanted to start with python.Though,when I download pycharm, I go to
> configure>settings>project interpreter and i can not put a project
> interpreter( I have download python version 3) .What should I do?thank you
> for your time.Because experiencing your loyal love is better than life
> itself,
>
>
Pycharm can be complicated to start with.  If you have problems getting
started, try out others like Spyder3 and Atom  - or emacs and vim :)

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


Re: pysftp / paramiko problem

2019-06-14 Thread Robin Becker

On 13/06/2019 18:23, MRAB wrote:
.



What does:

sftp.normalize('.')

return?


It returns '/'.

sftp.chdir('') and that also fails in paramiko as it seems to use 
CMD_REALPATH to do that.


  File "tsftp.py", line 7, in main
print(sftp.chdir(''))
  File "/home/rptlab/tmp/tpy3/lib/python3.6/site-packages/pysftp/__init__.py", 
line 524, in chdir
self._sftp.chdir(remotepath)
  File 
"/home/rptlab/tmp/tpy3/lib/python3.6/site-packages/paramiko/sftp_client.py", 
line 662, in chdir
self._cwd = b(self.normalize(path))
  File 
"/home/rptlab/tmp/tpy3/lib/python3.6/site-packages/paramiko/sftp_client.py", 
line 632, in normalize
t, msg = self._request(CMD_REALPATH, path)
  File 
"/home/rptlab/tmp/tpy3/lib/python3.6/site-packages/paramiko/sftp_client.py", 
line 813, in _request
return self._read_response(num)
  File 
"/home/rptlab/tmp/tpy3/lib/python3.6/site-packages/paramiko/sftp_client.py", 
line 865, in _read_response
self._convert_status(msg)
  File 
"/home/rptlab/tmp/tpy3/lib/python3.6/site-packages/paramiko/sftp_client.py", 
line 894, in _convert_status
raise IOError(errno.ENOENT, text)
FileNotFoundError: [Errno 2] No such file.


--
Robin Becker

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


Re: pysftp / paramiko problem

2019-06-14 Thread Robin Becker

...

I tried an experiment with a remote server that I control and pysftp works perfectly there. A difference that I know of is that 
this server is using ubuntu 18.04 and we don't use passwords, but a private_key. Also this server is using the openssh internal sftp.


I believe the failing server is using an earlier version of openssh or OS as it wants to use ssh-dss which is now considered 
unsafe  (I believe).

--
Robin Becker

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


Re: can not use pycharm

2019-06-14 Thread Informatico de Neurodesarrollo



El 10/06/19 a las 13:28, aris escribió:


Hello,this is my first time trying to learn coding and programming and I wanted to 
start with python.Though,when I download pycharm, I go to 
configure>settings>project interpreter and i can not put a project interpreter( 
I have download python version 3) .What should I do?thank you for your time.



Hi Aris:
You must go to: File -> Settings
and below of "Version Control" you find like this: Project:"project 
name" -> Project Interpreter and the top at your right hand you find 
litle button and you can add (configure) an interpreter: Virtualenv 
Enviroment, Conda Env., System Interpreter, Pipenv Env.., etc.


You must use the last (at least a version after mars of the last year ), 
because include the pipenv support.


I hope that can help you.

PD Before all, you must have already installed pipenv in your system.

--

Ing. Jesús Reyes Piedra
Admin Red Neurodesarrollo,Cárdenas
La caja decía:"Requiere windows 95 o superior"...
Entonces instalé LINUX.


--
Este mensaje le ha llegado mediante el servicio de correo electronico que 
ofrece Infomed para respaldar el cumplimiento de las misiones del Sistema 
Nacional de Salud. La persona que envia este correo asume el compromiso de usar 
el servicio a tales fines y cumplir con las regulaciones establecidas

Infomed: http://www.sld.cu/

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


What's the latest best practice on Python project directory layouts?

2019-06-14 Thread Malcolm Greene
I have a collection of command line scripts that share a collection of common 
modules. This code collection is for internal use and will run under a single 
version of Python 3.6+ and a single OS. My understanding of best practice is to 
organize this collection of Python files into a folder structure like this:

# common files
.gitignore
readme.md
requirements.txt
setup.py  <--- what is the advantage of this file for internally distributed 
code bases?

# app specific package folders
app-1
__init__.py (optional; if needed)
__main__.py 
app-1-module-1.py
app-1-module-2.py
app-1-module-N.py

app-2
__init__.py (optional; if needed)
__main__.py 
app-2-module-1.py
app-2-module-2.py
app-2-module-N.py

# modules shared across multiple apps
common
common-module-1.py
common-module-2.py
common-module-N.py

# tests - place at package level with sub-packages for each package -OR- 
underneath each app package?
tests
app-1
 test_app-1-module-1.py
 test_app-1-module-2.py
 test_app-1-module-N.py
app-2
 test_app-2-module-1.py
 test_app-2-module-2.py
 test_app-2-module-N.py

# virtual env folder placed at same level as packages ???
venv


And execute each app via the following ...

python -m app-1 

Questions

1. Does the above structure sound reasonable?
2. Where to place virtual env files and what to call this folder? venv, .env, 
etc?
3. Where to put tests (pytest)? In a tests folder or under each package?
4. Use a src folder or not? If so, where to put above files relative to the src 
folder?

Malcolm

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


Re: How control a GUI for an unrelated application from a Python script?

2019-06-14 Thread Christian Seberino
Thanks for all the help.  I'll definitely try to bypass the GUI first if 
possible.  This is on Windows 7 so maybe AutoIt will do the trick if can't 
avoid the GUI.  Thanks again everyone.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: How control a GUI for an unrelated application from a Python script?

2019-06-14 Thread Rob Gaddi

On 6/14/19 8:49 AM, Christian Seberino wrote:

Thanks for all the help.  I'll definitely try to bypass the GUI first if 
possible.  This is on Windows 7 so maybe AutoIt will do the trick if can't 
avoid the GUI.  Thanks again everyone.



Out of curiosity, what hardware?

--
Rob Gaddi, Highland Technology -- www.highlandtechnology.com
Email address domain is currently out of order.  See above to fix.
--
https://mail.python.org/mailman/listinfo/python-list


Re: Dataframe with two groups of cols. [RESOLVED]

2019-06-14 Thread Paulo da Silva
Às 04:56 de 14/06/19, Paulo da Silva escreveu:
> Hi!
> 
> How do I create a pandas dataframe with two (or more) groups of cols.?
> 
> Ex.:
> 
> G1   G2
> C1 C2 C3 C1 C2 C3
> Rows of values ...
> 
> I then should be able to access for example
> df['G2']['C3'][]
> 
> 
> Thanks.
> 

After digging a lot :-) , and for those who may be interested, I found
one way:

In [21]: d1 = pd.DataFrame(np.array([[1, 2, 3], [4, 5, 6], [7, 8,
9]]),columns=['C1', 'C2', 'C3'])

In [22]: d2 = pd.DataFrame(np.array([[10, 2, 3], [10, 5, 6], [10, 8,
9]]),columns=['C1', 'C2', 'C3'])

In [23]: d=pd.concat([d1,d2],keys=['G1','G2'],axis=1)

In [24]: d
Out[24]:
  G1G2
  C1 C2 C3  C1 C2 C3
0  1  2  3  10  2  3
1  4  5  6  10  5  6
2  7  8  9  10  8  9

In [25]: d['G2']['C1']
Out[25]:
010
110
210
Name: C1, dtype: int64

In [26]:
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Dataframe with two groups of cols. [RESOLVED]

2019-06-14 Thread Paulo da Silva
Às 18:31 de 14/06/19, Paulo da Silva escreveu:
> Às 04:56 de 14/06/19, Paulo da Silva escreveu:
...


> 
> After digging a lot :-) , and for those who may be interested, I found
> one way:
> 
> In [21]: d1 = pd.DataFrame(np.array([[1, 2, 3], [4, 5, 6], [7, 8,
> 9]]),columns=['C1', 'C2', 'C3'])
> 
> In [22]: d2 = pd.DataFrame(np.array([[10, 2, 3], [10, 5, 6], [10, 8,
> 9]]),columns=['C1', 'C2', 'C3'])
> 
> In [23]: d=pd.concat([d1,d2],keys=['G1','G2'],axis=1)
> 
> In [24]: d
> Out[24]:
>   G1G2
>   C1 C2 C3  C1 C2 C3
> 0  1  2  3  10  2  3
> 1  4  5  6  10  5  6
> 2  7  8  9  10  8  9
> 
> In [25]: d['G2']['C1']
> Out[25]:
> 010
> 110
> 210
> Name: C1, dtype: int64
> 
> In [26]:
> 

And I noticed that things are yet more flexible ...
For ex. we can add further data

In [12]: d['G3','C1']=['v1','v2','v3']

In [13]: d
Out[13]:
  G1G2G3
  C1 C2 C3  C1 C2 C3  C1
0  1  2  3  10  2  3  v1
1  4  5  6  10  5  6  v2
2  7  8  9  10  8  9  v3

... but starting with an empty dataframe does not work!
In [3]: df=pd.DataFrame()

In [4]: df['G1','c1']=[1,2,3]

In [5]: df
Out[5]:
   (G1, c1)
0 1
1 2
2 3

In [6]:

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


Re: How control a GUI for an unrelated application from a Python script?

2019-06-14 Thread Christian Seberino


> Out of curiosity, what hardware?

Texas Instruments ADS1675REF card
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: How control a GUI for an unrelated application from a Python script?

2019-06-14 Thread Rob Gaddi

On 6/14/19 11:14 AM, Christian Seberino wrote:



Out of curiosity, what hardware?


Texas Instruments ADS1675REF card



Condolences.  TI is a world-leader in giving every eval board its own 
complicated, proprietary digital interface, then not documenting it 
because "You can just use the provided software" that hasn't been 
updated since 2001 and doesn't actually let you test the thing you need to.


The underlying FPGA board that it's built on has its own page at 
https://opalkelly.com/products/xem3010/ with an SDK.  That may turn out 
to be your best way in.


--
Rob Gaddi, Highland Technology -- www.highlandtechnology.com
Email address domain is currently out of order.  See above to fix.
--
https://mail.python.org/mailman/listinfo/python-list


Re: How control a GUI for an unrelated application from a Python script?

2019-06-14 Thread Christian Seberino
On Friday, June 14, 2019 at 1:42:17 PM UTC-5, Rob Gaddi wrote:
> Condolences.  TI is a world-leader in giving every eval board its own 
> complicated, proprietary digital interface, then not documenting it 
> because "You can just use the provided software" that hasn't been 
> updated since 2001 and doesn't actually let you test the thing you need to.
> 
> The underlying FPGA board that it's built on has its own page at 
> https://opalkelly.com/products/xem3010/ with an SDK.  That may turn out 
> to be your best way in.

You don't know how right you are.  It gets even betterSince they don't 
update their Windows GUI apps...10 years later it won't run on the latest 
Windows.  I had to set up a Windows 7 machine to run their @#$# software!!! ;)

This is the dreaded GUI app ...

http://www.ti.com/tool/ADCPRO

(That Opal Kelly code is very nice but isn't designed to support all the TI 
boards the FPGA plugs into.  Believe me I tried that route. ;)

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


Re: What's the latest best practice on Python project directory layouts?

2019-06-14 Thread Cameron Simpson

On 14Jun2019 09:23, Malcolm Greene  wrote:

I have a collection of command line scripts that share a collection of common 
modules. This code collection is for internal use and will run under a single 
version of Python 3.6+ and a single OS. My understanding of best practice is to 
organize this collection of Python files into a folder structure like this:

# common files
.gitignore
readme.md
requirements.txt
setup.py  <--- what is the advantage of this file for internally distributed 
code bases?

# app specific package folders
app-1
   __init__.py (optional; if needed)
   __main__.py
   app-1-module-1.py
   app-1-module-2.py
   app-1-module-N.py

app-2
   __init__.py (optional; if needed)
   __main__.py
   app-2-module-1.py
   app-2-module-2.py
   app-2-module-N.py

# modules shared across multiple apps
common
   common-module-1.py
   common-module-2.py
   common-module-N.py

# tests - place at package level with sub-packages for each package -OR- 
underneath each app package?
tests
   app-1
test_app-1-module-1.py
test_app-1-module-2.py
test_app-1-module-N.py
   app-2
test_app-2-module-1.py
test_app-2-module-2.py
test_app-2-module-N.py

# virtual env folder placed at same level as packages ???
venv
   

And execute each app via the following ...

python -m app-1 

Questions

1. Does the above structure sound reasonable?


Yes. Though I like to get them out of the top directory, details below.


2. Where to place virtual env files and what to call this folder? venv, .env, 
etc?


I use "venv" myself.


3. Where to put tests (pytest)? In a tests folder or under each package?


Personally, I'd do it however you would do them if the apps and the 
common modules were standalone. I use a foo_tests.py beside my foo.py 
module file myself, but a naming scheme adhering to the discoverability 
of your test running tool would also be a good choice.


4. Use a src folder or not? If so, where to put above files relative to 
the src folder?


Well, yeah. Always a subdirectory, I hate littering the top level.

Here is how I lay out a project, based on my current one (nonPython bits 
elided):


 project/
   bin/
   lib/python/all-modules-here
   venv/

Various points:

- I dislike using Python's "search for modules in the current 
 directory"; I would _always_ rather set $PYTHONPATH for specific 
 control.


- The lib/python depth is to accomodate lib/other-languages according to 
 the mix in the project.


Some context: I'm making a full stack app for a client at present. The 
client's code is like this:


 lib/python/clientname/appname/*.py

It happens that all the "common" code is in the appname subdirectory 
because it is self contained, but were it not it would be in


 lib/python/clientname/*.py

or possibly

 lib/python/clientname/util/*.py

(or "common" if you prefer).

One important aspect of this is that it lets me keep the client code 
away from conflicts with other library names, so the "clientname" module 
path component is important for this, _and_ it better labels the purpose 
of the module.


So the environment setup looks like this:

 project=/path/to/project  # or $(dirname "$0") if $0 is useful
 PYTHONPATH=$project/lib/python
 PATH=$project/bin:$project/venv/bin:$PATH
 export PYTHONPATH PATH

and the app is run:

 python -m clientname.appname args...

The app does relative imports for itself:

 from .util import SomeAppClass

and would import common code absolutely:

 from clientname.util import SomeCommonClass

In my current project I've actually got a small shell script which does 
the environment setup above and invokes the python app (or various other 
utility tasks like "init the database" etc). I find this approach 
generally useful.


Anyway, this might inform what choices you make. Happy to elaborate on 
specifics, though they get more personal and idiosyncratic the more fine 
grained we get.


Cheers,
Cameron Simpson 
--
https://mail.python.org/mailman/listinfo/python-list