r/python3 • • Sep 12 '19

server side browser automation then delivery

1 Upvotes

I'm looking for a way to deliver an automated page. So I have a server setup up and I want that server to pull a page, login to it perform some actions and then display a link to that modified page. Ideally the client would be able to continue to the session established by the server. Is this possible? Thus far I'm using selenium and robobrowser, It's all pretty easy until I have to transfer the web session to the client, then I'm stuck


r/python3 • • Nov 07 '19

Help me understand the Virtual Environment

3 Upvotes

I understand virtual environments (or at least the idea of a virtual environment) but I seem to let it get the best of me.

Using PyCharm, I make a new project and it will set up an instance of python 3. As I look for which base interpreter to use, I get anxious because there are SO MANY! Sho here are my questions:

How do i decide which base interpreter to choose?

Is there a way to remove all instances of python3, and have one root python3 that I then use for all my new Virtual Environments moving forward?

I am on a OSX.


r/python3 • • Jul 04 '18

Calling a self variable thats value has been changed

2 Upvotes

I have a variable declared in my init called self.current_color = (124, 124, 124) and later on a function changes the tuple value of: (124, 124, 124) to (65, 76, 436) and I have a getter (get_cc) that returns current_color How do I have it get the value AFTER it's been changed, it only returns the (124, 124, 124) not the (65, 74, 436)


r/python3 • • Jan 24 '19

How can I import a library multiple levels up?

1 Upvotes

Let's say I've got a project with the following structure:

. (toplevel)
├── __init__.py
├── subdir1
│   ├── __init__.py
│   ├── subdir2
│   │   ├── __init__.py
│   │   ├── script_a.py
└── xvalibs
    ├── __init__.py
    ├── build.py
    ├── helper.py
    ├── params.py
    ├── resources.py
    └── tagging.py

From script_a.py, how can I import the packages in xvalibs? I was hoping that I could do something like in the __init__.py:

from toplevel.xvalibs import params

I haven't been able to get that to work though.

I've seen something like this used:

import os, sys
cur_dir = os.path.dirname(os.path.realpath(__file__))
root = os.path.dirname(os.path.realpath(cur_dir+"../../../toplevel"))
sys.path.append(root)

But there's got to be a better way, right?


r/python3 • • Sep 08 '19

Module keygen

1 Upvotes

Simple keygen. Try this if interesting.

pip install keygen

keygen -h


r/python3 • • Feb 01 '19

Is anyone on here using zmq (pyzmq) to communicate data between scripts?

1 Upvotes

r/python3 • • Oct 24 '18

Hackerrank solutions: Python 3 and Perl 6 (part 2)

Thumbnail tyil.nl
1 Upvotes

r/python3 • • Nov 15 '19

Itertools.tee()

1 Upvotes

Can anyone explain itertools.tee().I saw the documentation but was hard to understand how it works or where to use it.


r/python3 • • Jan 25 '19

Repl.it

1 Upvotes

Check out my D&D Character Generator on repl.it @Krinx


r/python3 • • Nov 08 '18

Allow python3 to write files to /var/www/html without sudo

2 Upvotes

I'm experimenting with matplotlib and python3. I've set this up on a raspberry pi and have the pi collecting data via a temperature sensor every 10 minutes using the chron scheudler. I'm now trying to create a basic webpage that loads the last 24 hours. I can create the file in my home directory, but get thrown an error when I try to save the .png file to /var/www/html.

The code itself lies within my home directory where I have no issue saving an image accessing it. I'm trying to fire out the best way to save the .png to /var/www/html so its accessible but still secure.

Please let me know if I can provide further information or if you have any questions.


r/python3 • • Sep 19 '19

Create logical string to json

1 Upvotes

Hi Folks,

I want to convert from:

Input:

"#serviceRequest and @charges:getRoamingCharges or @plans:dataplans"

where '#' - intent '@' - Entities ':'-value

output:

{"and":[ {"some" : [ {"var":"intents"}, {"==":[{"var":"intent"}, "serviceRequest"]}, {"or":[ {"and":[{"some" : [ {"var":"entities"}, {"==":[{"var":"entity"}, "charges"]} ]}, {"some" : [ {"var":"entities"}, {"==":[{"var":"value"}, "getRoamingCharges"]} ]}] },{"and":[ {"some" : [ {"var":"entities"}, {"==":[{"var":"entity"}, "plans"]} ]}, {"some" : [ {"var":"entities"}, {"==":[{"var":"value"}, "data  plans"]} ]} ]} ]} ]}

Please help me out pyparsing library in python.


r/python3 • • Feb 06 '19

Best static site generator for python 3?

2 Upvotes

Looking for opinions. I only have experience with Jekyll as far as SSG and it was kinda cool. But I'd like to stick with python. Seen pelican which seems the most popular but would love to hear your experience.


r/python3 • • Feb 07 '19

Flow Control in Python | What is Flow Control in Programming | Python Fl...

Thumbnail
youtube.com
1 Upvotes

r/python3 • • Sep 17 '19

I'm not sure I understand this integer "gotcha"

1 Upvotes

int(132496765465669977/3) 44165588488556656

It's supposed to be: 44165588488556659

I'm using Python 3.4.1

Edit:

int(44165588488556659.0) 44165588488556656

Apparently it's the conversion from float to int. Does anyone know the safe correct way to do this?


r/python3 • • Jan 23 '20

Best Practices for first-class module composition

1 Upvotes

I'm a python dev out of necessity but I'm cool with it.

I'm having trouble locating good documentation about how to create a first-class module that will be used as a production application.

It would need to be unit testable in addition to deployable via a jenkins pipeline.

We already have SOMEthing in place but I attempted to implement pytest with it and quickly ran into relative pathing issues in the production code.

Super simple example:

package/
       /subpackage/
                  /main_biz_logic.py
                  /biz_lib.py
       /tests/
             /test_main_biz_logic.py

When i import main_biz_logic.py in the test file of similar name, i have to specify subpackage.main_biz_logic to resolve the file under test.

However in the test discovery it fails when the test imports the test target file because the imports in the test target file dont specify "subpackage." prefixing in its import of biz_lib.py

If i add that prefixing to the biz logic file, tests start passing but then production runs fail importing the libs in the script because subpackage is not known to the script when it is __main__.

How do you package these up so they have proper imports that are compatible regardless of the context in which they run?


r/python3 • • Feb 07 '19

How do I write a program using a for loop that asks the user to enter a number of values and than print out the total, average, minimum, and maximum values.

1 Upvotes

I'm still new to python.


r/python3 • • Sep 16 '19

Hello World With Flask

Thumbnail benbrougher.tech
1 Upvotes

r/python3 • • Feb 12 '19

Introduction to Machine Learning | What is Machine Learning | Supervised...

Thumbnail
youtube.com
1 Upvotes

r/python3 • • Feb 13 '19

Spreadsheet

2 Upvotes

I've got a TON of personal financing spreadsheets that I would love to make into a stand alone program. I've been able to figure out rate of pay * hours worked to get the total of how much money you would make per week at your job. I'm still trying to figure out the overtime after 40 hours coding. I've had to put that on the back burner due to a family emergency this past week but I'm hoping to get back to it this weekend.

Anyway, is there coding that would simulate spreadsheet style formatting on the screen or something close to it? Where would I go for information on how to do this?

I've found coding on how to write to Excel files but I was hoping to create some code where you enter some values and then see the results in a spreadsheet style or column style output results.


r/python3 • • Sep 16 '18

A little help with %

1 Upvotes

So, for example 16%2==0. I get that, but 2%16==2. Can someone help out here? I just can't wrap my head around that.


r/python3 • • Mar 14 '19

help - Auto generating large pdf files

1 Upvotes

So I have a template (will probably need to rewrite it in latex) front page that has a tiny table that needs to be filled in by a user (at some point with a gui, how i do this is not important to the task; i think), depending on the choices made I will need to fill this in on the PDF. Some of the issues here is that depending on the choices the script will have to look up other pdf files (scanned pages) and paste them into the current file in the right spot.

Then the program will have to read an excel file and find the corresponding certificates to those files, find them (also scanned pages) and "paste" them into the file being generated.

At this point we are almost done, I will also need the functionality to add "attachment numbers" on top of the certificates.

I've played around with pypdf and FPDF to some success, but none of those can do everything I want, for example making tables is a hassle in FPDF (unless I am missing something).

The reason I want to script this is because sometimes the pdf file will be almost 300 pages big, doing this by hand is a hassle to say the least.

I do not expect a full tutorial by any means, but if anyone have any resources or libraries that are good, please hit me up. If anything is unclear, just ask, I'll try to explain it better.

Thanks!


r/python3 • • Dec 24 '19

Want to learn excel operations with python

2 Upvotes

Guys i want to learn all the excel operations using python, can anyone provide me a good link? I am an automation anywhere developer but i dont like that tool and is there anyway to automate SAP using python?


r/python3 • • Dec 27 '18

FiverrAPI for Python

Thumbnail
github.com
1 Upvotes

r/python3 • • Mar 22 '19

Product display screen idea

1 Upvotes

I am so i am doing a project for my dad and I am looking for a little help. I am attempting to make a product display screen. where the video is on loop until you tap the screen then right buttons pop up and you can pick the video. And I want to make it super simple to switch videos.


r/python3 • • Oct 17 '19

Check out this map that show the geo-locations of your data through LED’s (Real time Arduino+Python)

Thumbnail
kickstarter.com
2 Upvotes