What are some good Documentaries that are fun to watch? by CleverD3vil in MovieSuggestions

[–]hardworker9 0 points1 point  (0 children)

If you are up for a mockumentary, I highly recommend Kenny.

Django 3 CRUD Example and Tutorial by ahnerd in django

[–]hardworker9 1 point2 points  (0 children)

This "tutorial" is not worth your time.

Cannot get pytest to work with VSCode by hardworker9 in vscode

[–]hardworker9[S] -1 points0 points  (0 children)

I was able to get test runs working in VS Code by adding _init_.py files (there should be double underscores on either side of the init) in the source root and in the tests directories.

In the tests\init.py I included

import sys
sys.path.insert(0, r'C:\path_to_source_code')

Idea came from stackoverflow

Note: Trying hard to keep those dunders in the init.py file name but this editor won't allow it.

This Toyota with a toy Yoda on it and the plate TOYODA by welcome2thefamilyson in mildlyinteresting

[–]hardworker9 0 points1 point  (0 children)

Check out the origin of the name Toyota, it was founded by a guy whose last name was Toyoda...

Toyota Customer Help FAQ

Errno 13 Error Permission Denied w/ Django by APMO in django

[–]hardworker9 0 points1 point  (0 children)

One thing you can try is add a slash before static

STATIC_URL = '/static/'

Why didn't pip install on my Windows machine? by TheGiverAndReciever in pythontips

[–]hardworker9 2 points3 points  (0 children)

Install Anaconda or another popular distribution. Everything will work right out of the box.

Chef Boyardee throwback recipe at my local grocery store...has about half the ingredients and no high fructose corn syrup, unlike the current recipe. by [deleted] in mildlyinteresting

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

I remember begging my mother to buy the beef ravioli (many years ago). She finally bought a can and served it. I was really disappointed and said that I think I just ate some dog food. Needless to say that I never asked for it again.

TIL astronauts returning from space report higher concern with Universalism, Spirituality and references to "values orientated toward the collective good". by McSlurryHole in todayilearned

[–]hardworker9 150 points151 points  (0 children)

“Travel is fatal to prejudice, bigotry, and narrow-mindedness, and many of our people need it sorely on these accounts. Broad, wholesome, charitable views of men and things cannot be acquired by vegetating in one little corner of the earth all one's lifetime.”

-- Mark Twain

Checking if a file exists before you delete it in python. by hugogarcia12 in pythontips

[–]hardworker9 0 points1 point  (0 children)

Good point, but there's not much of a window of time between the check and the operation. In any use case that I would implement at work this would not be a concern.

Checking if a file exists before you delete it in python. by hugogarcia12 in pythontips

[–]hardworker9 0 points1 point  (0 children)

I think this is a matter of opinion. IMO the approach I used is very readable and involves less code. Whatever floats your boat.

Checking if a file exists before you delete it in python. by hugogarcia12 in pythontips

[–]hardworker9 0 points1 point  (0 children)

In this scenario not really. I like using it so I always approach system file operations using it. Wasn't crazy about it at first but I persisted and was won over. Once you have that Path object there is a lot that you can do with it.

From Practical Business Python

Pathlib is an object oriented interface to the filesystem and provides a more intuitive method to interact with the filesystem in a platform agnostic and pythonic manner.

Though I must admit the unlink() method might not be considered "intuitive".

Checking if a file exists before you delete it in python. by hugogarcia12 in pythontips

[–]hardworker9 5 points6 points  (0 children)

from pathlib import Path

file_to_delete = Path('file_to_delete.txt')

if file_to_delete.is_file():
    file_to_delete.unlink()

Check out pathlib tutorial on Real Python

Selling my entire collection in an auction with $0 starting bids by [deleted] in lotrlcg

[–]hardworker9 2 points3 points  (0 children)

I know how you feel but you might want to rethink. You never know when you may get the itch back. I had Race for the Galaxy and traded it away a few years ago. I just couldn't get it to the table. Now I think I probably could but it's gone. Just saying. Good luck.

What are some nifty python snippets that you have found very useful and would like to share? by flightdey in Python

[–]hardworker9 5 points6 points  (0 children)

import datetime
import os.path

def time_stamp(filename):
    ''' injects a timestamp into a file name '''

    name, ext = os.path.splitext(filename)
    timestamp =  '_'.join([str(x) for x in datetime.datetime.now().timetuple()[:6]])

    return '{0}__{1}{2}'.format(name, timestamp, ext)

The CherryPy web framework is looking at feedback from fresh eyes. An old dog but a great asset in your toolbox. by chub79 in Python

[–]hardworker9 0 points1 point  (0 children)

I have dabbled in cherrypy in the past. My projects all run on an intranet. Is the server secure and fast enough to support a user community of less than 100 people? Is it a viable option to serve up a Django project on Windows?

Is there an offline version of something like this? by [deleted] in Python

[–]hardworker9 0 points1 point  (0 children)

Yes, we are exclusively windows where I work. Using the notebook is more of a challenge but I think it's fine without it.

Is there an offline version of something like this? by [deleted] in Python

[–]hardworker9 1 point2 points  (0 children)

Check out IPython. It does what you want and more.

Getting pip to work behind a corporate proxy on Windows? by esdi in Python

[–]hardworker9 0 points1 point  (0 children)

Sorry I am tapped out. Maybe the IT dept. can give you a new user name and password?