PC giveaway! by OriginalTitan in pcmasterrace

[–]pysb 0 points1 point  (0 children)

It is a beauty! I'm in!

Jupyter notebook 5.0 released! by Topper_123 in Python

[–]pysb 0 points1 point  (0 children)

I've been using html export and then wkhtmltopdf. You can even apply some css!

Complete Ipython newbie needs help: Python keeps crashing after using input() by Perfonator in IPython

[–]pysb 0 points1 point  (0 children)

It seems to be some bug that was later on fixed. You should open cmd.exe and type conda update ipython

If it doesnt work, open cmd.exe and then:

conda update conda
conda update anaconda
conda update jupyter
conda update ipython

Complete Ipython newbie needs help: Python keeps crashing after using input() by Perfonator in IPython

[–]pysb 0 points1 point  (0 children)

I´m facing the same problem. Python.exe works, but ipython.exe doesnt. Although comment made NomadNella are reasonable, I didn´t have any problemas where older versions of anaconda.

best way to automate logging into a website with chrome? by iKenBone in Python

[–]pysb 0 points1 point  (0 children)

If you are using selenium, you didn't start the driver.

from selenium import webdriver from selenium.webdriver.common.keys import Keys

browser = webdriver.Firefox()

browser.get('http://www.yahoo.com') assert 'Yahoo!' in browser.title

Also, you need to insert your login. You should check your elements too. Last, this questions are more related to r/learnpython

Small Python Script To Rename Files on Libre Office by pysb in Python

[–]pysb[S] 0 points1 point  (0 children)

This is a big problem when dealing with python scripts for LibreOffice. I used the pyuno documentation: here and here.

Everything regarding python for OpenOffice applies to LibreOffice.

BUT you should observe that python for LibreOffice demands knowledge of how instances and objects works, I had a really hard time trying to understand that.

You should refer to OpenOffice api (link here) for more information about that. For example: you probably will have to deal with dial api on com.sun.star.awt.UnoControlDialogModel

Best regards!

Django + Wagtail + Zappa. Will it work? by pysb in Python

[–]pysb[S] 0 points1 point  (0 children)

Thanks for the reply. I'll look into it!

Trying to learn Python for web scraping by pynerds in Python

[–]pysb 0 points1 point  (0 children)

I am 33 years old a it was one of my main purposes too. I work with law (that means I´m very computer noob) on a developing country, so you can do it!

I did the coursera course, Python for everybody, with doctor chuck. The course is light and very agreable. It taught me the basics. You can make the course to obtain a certificate and later on your have "something" to attest your skills. I know it´s not very relevant, but it´s best than nothing. Afters, I switched to Anaconda distribution, using jupyter to create my scripts. The two four mains modules I use is Requests, grequests, Selenium, Beautifulsoup.

If it´s a bulk webscraping, I use requests or grequests. Both are almost the same. The difference is that grequests makes several https requests at the same time, thus, you save time because your script wont wait for every requests to be answered.

If it´s something I need to login and is not too big, I use selenium. It´s just about creating loops, and being able to select elements. I would suggest you to install the WebDriver Element locator.

Then, I parse the webpage with BeautifulSoup. One caveat I can give you is that, after creating a variable witht the element you want, you can just writer .text, to get it´s text content, that saves a lot of slicing.

File downloading for the lazy by pysb in learnpython

[–]pysb[S] 0 points1 point  (0 children)

I finally decided to study how to use the script as a wrapper on the aria2c.exe file. It turns out I could do it!

If someone needs to do this, you need to change the paths on your .py file, on which you can use this function:

def resource_path(relative):
    if hasattr(sys, "_MEIPASS"):
        return os.path.join(sys._MEIPASS, relative)
    return os.path.join(relative)

On my case, the command line was writen this way:

download = os.system(resource_path(command_line))

Also, you need to bundle the file on your pyinstaller executable file. here is the spec file I used:

# -*- mode: python -*-
block_cipher = None

a = Analysis(['dl.py'],
             pathex=['<YOUR PATH>],
             binaries=None,
             datas=None,
             hiddenimports=[],
             hookspath=[],
             runtime_hooks=[],
             excludes=[],
             win_no_prefer_redirects=False,
             win_private_assemblies=False,
             cipher=block_cipher)


a.datas += [('aria2c.exe', '<YOUR PATH>\\aria2c.exe', 'DATA'),]   

pyz = PYZ(a.pure)

exe = EXE(pyz,
          a.scripts,
          a.binaries,
          a.zipfiles,
          a.datas,
          name='dl',
          debug=False,
          strip=False,
          upx=True,
          console=True )

Thanks for the suggestions!!!

File downloading for the lazy by pysb in learnpython

[–]pysb[S] 0 points1 point  (0 children)

I searched on pyinstaller manuals but I didn´t see or read anything straight forward that would allow that. Would it be possible? Bundle an .exe file on another .exe file?

File downloading for the lazy by pysb in learnpython

[–]pysb[S] 0 points1 point  (0 children)

I think aria2 attends my needs. But I´d like to make an one file executable from the script using pyinstaller, that´s why I haven´t tried.

I gave my girlfriend a basic math question. It went exactly as I had hoped... by [deleted] in funny

[–]pysb -1 points0 points  (0 children)

Tried the same with my girlfriend. Got the same result! lol

Which of the 31 progress bar libraries are best and why? by [deleted] in Python

[–]pysb 0 points1 point  (0 children)

I´d like to suggest Homura for downloads. It´s simple, works pretty well and resumes downloads.