Skip to content

Instantly share code, notes, and snippets.

View liamcryan's full-sized avatar

liamcryan

View GitHub Profile
@liamcryan
liamcryan / v(venv)env
Created May 7, 2021 20:26
create venv within venv (with_pip=True)
"""
Normally to create a virtual environment, we can do so from the command prompt with::
C:\Users\me>python -m venv venv
This doesn't work when we are within a virtual environment though::
(venv) C:Users\me>python -m venv venv2
Error: Command '['C:\\Users\\me\\venv2\\Scripts\\python.exe', '-Im', 'ensurepip', '--upgrade', '--default-pip']' returned non-zero exit status 3221226505.
@liamcryan
liamcryan / gist:e4bfd16fa2b685c3f8d3af0e4f27bf43
Created March 6, 2018 19:34
working with byte strings in memory
# i read an excel file from gmail, and the response was returned as bytes like:
# b'this is my excel file as a byte string'
# i wanted to use pandas to get this into a dataframe using pd.get_excel(filename).
# typically I would input the path to the excel file, which would require me to
# save the excel file first using:
with open("my_file.xlsx", "wb") as f:
f.write()