python – Why can't I click on this item immediately after finding it depending on when in code I try to click on it?

Just for preface, I have just started playing with python and I have no understanding of many python specific concepts.

I'm refactoring code and I'm trying to hide my janky error handling to get selenium web items, and I ran into a strange problem when passing items:

import time
from selenium.webdriver.chrome.webdriver import WebDriver
import selenium


def highlight(element):
    """Highlights (blinks) a Selenium Webdriver element"""
    driver = element._parent
    def apply_style(s):
        driver.execute_script("arguments(0).setAttribute('style', arguments(1));",
                              element, s)

    original_style = element.get_attribute('style')
    apply_style("background: yellow; border: 2px solid red;")
    time.sleep(.3)
    apply_style(original_style)


def find_element(driver: WebDriver, xpath: str, url: str = "", test: bool = True, max_timeout: int = -1,
                 max_attempts: int = -1, time_between_attempts: int = 0) -> selenium.webdriver.remote.webelement.WebElement:
    if url:
        driver.get(url)
    start_time = time.time()
    end_time = start_time + max_timeout
    attempt_count = 0
    element: selenium.webdriver.remote.webelement.WebElement
    while time.time() < end_time if max_timeout >= 0 else True and 
                                                          attempt_count < max_attempts if max_attempts >= 0 else True:
        attempt_count += 1
        try:
            element = driver.find_element_by_xpath(xpath)
            if test:
                print("highlighting")
                highlight(element)
            # element.click()
            break
        except:
            time.sleep(time_between_attempts)
            pass
    # should only be past here if something went wrong so send error
    element.click()
    raise Exception("could not get element")

My error appears on element.click (). As it stands, I will get an error stating that the item is not interactive. But if I use element.click () instead inside the try catch block, it will still work, no problem.
If I execute the lower element.click () in a while-try-break-except loop like the first, it will end up clicking.

Why does this happen? It doesn't seem like this is a race condition or that html is still loading or something like that, otherwise the first element.click () would fail. I just want to be able to pass these elements through my code. Thank you

catalina – python will not compile on macos due to ssl error

I have been a python developer for two years. I was working on Ubuntu, life was easier.
Yesterday they gave me a Mac book.
I'm really embarrassed to say it, but I couldn't even manage to create a python env on the machine.

Can someone tell me what i am doing wrong?
I am trying to install Python 3.5.2.
My MacOS versions are 10.15.2.
I keep receiving this ssl error even if open ssl is installed.

$ brew uninstall openssl
$ brew install openssl
$ export CFLAGS="-I$(brew --prefix openssl)/include"
$ export LDFLAGS="-L$(brew --prefix openssl)/lib" 
$ pyenv install 3.5.2`

I went to several sites, they said it was a macos problem, but how come everyone is doing it.
I receive ssl error on the python compilation.

ERROR: The Python ssl extension was not compiled. Missing the OpenSSL lib?
Please consult to the Wiki page to fix the problem.
https://github.com/pyenv/pyenv/wiki/Common-build-problems
BUILD FAILED (OS X 10.15.2 using python-build 20180424)

Inspect or clean up the working tree at /var/folders/gm/t0h6v8jx4bqd6cj73_k27myw0000gp/T/python-build.20200118112759.40760

Results logged to /var/folders/gm/t0h6v8jx4bqd6cj73_k27myw0000gp/T/python-build.20200118112759.40760.log

Last 10 log lines:
(cd /Users/users/.pyenv/versions/3.5.2/share/man/man1; ln -s python3.5.1 python3.1)

if test "xupgrade" != "xno" ; then \
 case upgrade in \
  upgrade) ensurepip="--upgrade" ;; \
  install|*) ensurepip="" ;; \
 esac; \
  ./python.exe -E -m ensurepip \
  $ensurepip --root=/ ; \
fi

Ignoring ensurepip failure: pip 8.1.1 requires SSL/TLS

I am trying to install this python using pyenv of this guide. When i check brew openssl is installed correctly.

Even the CPPFLAGS the variable is defined pointing to the location ssl, that is to say -I/usr/local/opt/openssl@1.1/include. Same for LDFLAGS pointing to -L/usr/local/opt/openssl@1.1/lib
The solutions suggested here did not work for me either.
Manually compiling Python from source also gives the same error, which is why I tried to use pyenv in the first place.

With the default python3 who comes with Catalina, I can use virtualenv to create an environment and install packages.
But in this case, I continue to receive errors. I'm new to MacOS but it shouldn't be that difficult, it's just another operating system but I'm already skeptical about it,

All I want is to install Python 3.5.2 on my machine. Is it so much to ask?

python – A restful bottle file is downloaded asynchronously?

I am working on converting a monolithic solution based on existing python into a microservice. The current flow is quite simple:

Accept XLSX as input -> execute complex algorithms based on input -> generate XML

I created two services using Flask Restplus:

  • storage – this relates to storing / downloading / deleting any input or output file. When a user calls / upload / with an xlsx file, this service will store the given file and send the download_url back to the user in response.
  • gen – User calls this service by passing the download_url in a request, this service downloads the file, processes it, generates the output file, downloads the output file to storage by calling a service endpoint of storage.

However, at times we have seen that the input files we receive are large (~ 2 GB) and it takes time to download them. Now, we are concerned that if multiple users download huge files simultaneously, our system will go hand in hand.
We made the gen service asynchronous using celery + RabbitMQ. But, I don't know what needs to be done for the file download part.

Try to sort the text in groups to decrypt the alphanumeric codes (Python IDE 3)

I am using Python IDE 3. My goal is:
If I have a text string, "ABCDEFGHIJKL", I want to sort it into groups, like three groups ("ADGJ", "BEHK", "CFIL").
I need an entry for this, but the prompts do not appear and I cannot type in entry. Here is my code:

#data
code_text = input('Text: ').lower()
code_skip = int(input('Shift length: '))
code_list = ()
#function
def countSkip(text, shift, list):
    i = 0
    set = 1
    def iterate():
      if set <= shift:
        for e in text:
#make sure the set starts at the right place
          if e.index()+1 < set:
            pass
          elif shift != 0:
            if i = shift:
              list.append(e)
              i = 0
            i += 1
          else:
            list.append(e)
          set += 1
    iterate()
#calling function    
countSkip(code_text, code_shift, code_list)

python – JINJA2 – Problems formatting the html model

Expensive,

I am literally "thinking about it" to format a table with 3 columns in jinja2.

In the following JSON, there are fields that will go to the html page header, redrawn by jinja2, and there is a key, "evidence", where are the fields that should appear in the table , which are: date, description and message.

{"remetente": "Joao Joao", "de": "joao.joao@umdominioqualquer.com", "para": "maria@outrodominio.com", "assunto": "teste 13:25", "apixID": "937C91F8A75", "size": "922", "envio": "17/Jan/2020 - 13:25:53", "evidencias": ({"timestamp": "17/Jan/2020 - 13:25:52","descricao": "Conexão do usuário XXXX no servidor XXXXX","evidencia": "client=201-27-49-53.dsl.telesp.net.br201.27.49.53 sasl_method=PLAIN sasl_username=XXXXXX"},{"timestamp": "17/Jan/2020 - 13:25:53","descricao": "entrega da mensagem na fila de envio do servidor XXXXX","evidencia": "message-id="},{"timestamp": "17/Jan/2020 - 13:25:53","descricao": "Mensagem aceita pela fila do servidor XXXXX","evidencia": "from= size=922 nrcpt=2 (queue active)"},{"timestamp": "17/Jan/2020 - 13:25:53","descricao": "Mensagem entregue ao servidor do destinatário","evidencia": "to= relay=aspmx.l.google.com172.217.197.27:25 delay=1 delays=0.6/0.01/0.15/0.26 dsn=2.0.0 status=sent (250 2.0.0 OK  1579278353 v124si15259306qki.350 - gsmtp)"},{"timestamp": "17/Jan/2020 - 13:25:53","descricao": "Mensagem entregue. Removida da fila.","evidencia": "removed"})}

My jinja2 model is as follows:



  
    laudo envio e-mail
  
  
    

Remetente: {{data.remetente}}

de: {{data.de}}

Para: {{data.para}}

assunto: {{data.assunto}}

evidencias:

{% for ???? in ????? %} {% endfor %}

I am asking for help to format the jinja2, because I have tried everything 🙁

python – Illegible notebook (jupyter)

I couldn't open a specific .ipynb notebook, the error that appears to me is the one shown in the picture. In this same folder, I have another Notebook but this one opens without problem (I work on Ubuntu)

Advices?

Thank you very much in advance.

enter description of image here

Correct configuration of the Python project – Exchange of code revision stack

I have been asked to migrate this question from SO here.

I know there are already several questions regarding folder structures, relative imports, modules / scripts and __init__.py files, but even after reading about these topics, the proper configuration of the project is still the thing that bothers me the most about python.

To this end, I have created a sample project which should, I hope, clarify all of the various imports and calls that I can make and how to handle them, so that I can hopefully use it as a template for all future projects. Here is the structure of the project:

Sample
├── __init__.py
├── __main__.py
├── package1
│   ├── foo.py
│   └── __init__.py
├── package2
│   ├── bar.py
│   ├── __init__.py
│   └── subpackage
│       ├── baz.py
│       └── __init__.py
├── test.py
└── utils.py

the __init__ the files are currently (intentionally) left empty and I (again intentionally) avoided explicit relative imports. To avoid cluttering this message with the content of each file, I uploaded the entire project to GitHub.

I would like to correct the project configuration, if possible by making only the following changes:

  • Change imports from absolute to relative or vice versa
  • Adding stuff to the different __init__.py files

so the following calls resolve all without ImportErrorsand ModuleNotFoundErrors:

  • user@pc:/path/Sample$ python .
  • user@pc:/path$ python Sample
  • user@pc:/$ python path/Sample
  • user@pc:/path$ python Sample/__main__.py
  • user@pc:/path$ python Sample/test.py
  • user@pc:/path$ python Sample/package2/subpackage/baz.py

Bonus points if the following calls also execute without error (provided the sample project is on the Python search path):

  • python -m Sample
  • python -m Sample.test
  • python -m Sample.package2.subpackage.baz
  • python -m Sample.package2.baz

The critical parts of my code that need to be addressed are:

  • the different types of imports from lines 1 to 4 of __main__.py
  • import to line 2 of test.py, which requires baz be available from package2, rather than its full path of package2.subpackage (this is what is currently causing an error at runtime test.py); this is similar to how, for example, we can do from keras import Model, instead of from keras.models import Model.
  • online import 1 of baz.py, which imports a module to the next level from a sub-package (this is currently causing an error at runtime __main__.py

Can I correct the project with only the changes listed above? Are there any other changes to the configuration of my project to comply with Python standards?

how to import python code in the click button of the html page

import sub-process
pid = subprocess.Popen ("putty.exe root@10.12.21.31 -pw root123"). pid

i want to import this python program in html code

cpython – read value from address in memory with python

I need my script to read an external variable and to bring the value to a variable inside the script, this external variable is the integer type of 4 bytes, I have searched for many solutions but not concrete and I have nowhere to look, until I can use a script that the output changes depending on the value of the variable but the output is in bytes and I can't not decode it. I have no way out, can someone help me?
It follows the code I am using.

    #-*- coding: cp1252 -*-

import ctypes, win32ui, win32process ,win32api

PROCESS_ALL_ACCESS = 0x1F0FFF
HWND = win32ui.FindWindow(None,"3D Pinball for Windows - Space Cadet").GetSafeHwnd()
print(HWND)
PID = win32process.GetWindowThreadProcessId(HWND)(1)
print(PID)
PROCESS = win32api.OpenProcess(PROCESS_ALL_ACCESS,0,PID)

rPM = ctypes.windll.kernel32.ReadProcessMemory
wPM = ctypes.windll.kernel32.WriteProcessMemory

ADDRESS1 = 0x0475ECC4
ADDRESS2 = ctypes.create_string_buffer(64)
pi = ctypes.pointer(ADDRESS2)
rPM(PROCESS.handle,ADDRESS1,ADDRESS2,64,None)
valor = ADDRESS2.value
print(valor)
x=ctypes.windll.kernel32.GetLastError()
print(x)

python – How to analyze this weird INI file with the extension .dat

I came across this data source to include it in my current NodeJS project and I was completely disheartened by the fact that it seemed impossible to parse through any script that I did. 39; try to create.

Apparently, this file is not a normal INI file: it has regular sections and the lines in the sections have no key, but these lines have fields separated by a & # 39; | & # 39; character, some of which explain the meaning of these fields and are correctly commented. I would like to transform this file into a much more usable JSON but I cannot, for the life of me, find an appropriate way to manage it (mainly because of the duplicate lines).

How would you do it (possibly using Python or Node)?

Example

(FIRs)
;ICAO|NAME|PREFIX POSITION|
;dummy codes for Adria CTR
ADR|Adria Radar||ADR
ADR-W|Adria Radar (West)|ADR_W|ADR-W
ADR-E|Adria Radar (East)|ADR_E|ADR-E
AGGG|Honiara||AGGG
ANAU|Nauru||ANAU
AYPM|Port Moresby||AYPM
BGGL|Sondrestrom|SFJ|BGGL
BGGL|Sondrestrom|GREN|BGGL
BIRD|Reykjavik||BIRD
BIRD-E|Reykjavik ACC (East) - Reykjavik|BIRD_E|BIRD-E
BIRD-N|Reykjavik ACC (North) - Reykjavik|BIRD_N|BIRD-N
BIRD-S|Reykjavik ACC (South) - Reykjavik|BIRD_S|BIRD-S

If you want to view the file for yourself, here it is (github.com).

Proxy Sites Proxy Tunnels Proxy List Working Proxy Sites Hotproxysite Proxy Sites Proxy Sites Anonymous Proxy Anonymous Proxies Top-Proxies.co.uk http://www.proxysitesnow.com Proxy Servers Free Proxies Free Proxy List Proxy List Zoxy Proxy List PR liste all proxy sites More Proxies netgofree netgofree Hide-MyIp - The Best Proxy List American Proxy List www.proxylisty.com/proxylist Web Proxy Submit Proxies Updated Proxy List Updated Proxy List aproxy.org Bypass Proxy Sites Free Proxies List Evolving Critic Business Web Directory Free Proxy List iShortIt MyProxyList Online Proxies Go Proxies Need Proxies PrivateProxies Proxies4MySchool Proxies4Work Free Proxy List Free Proxy Sites ProxyInside Wiksa Proxy ProxyLister.org Free Proxy List ProxyNoid Proxy List Free Proxy List Proxy Sites Proxy TopList ProxyVille UK Proxy WebProxy List RatedProxy.com - Listing the best Web Proxies Free Proxy List SchoolProxiesList Stay Anonymous Proxy List The Power Of Ninja Proxy List UNubstruct Free proxy sites Free proxy sites
data e hora descrição evidência
data.evidencias.timestamp data.evidencias.descricao data.evidencias.evidencia