Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • 15:13
    HegiRaket opened #12042
  • 08:37
    liho98 commented #6193
  • 06:35
    bollwyvl closed #873
  • 06:33
    bollwyvl closed #872
  • 05:52
    geoegepaul123 opened #873
  • 05:48
    geoegepaul123 opened #872
  • 05:44
    geoegepaul123 edited #871
  • 05:44
    geoegepaul123 opened #871
  • 04:00
    Carreau opened #12041
  • 04:00
    Carreau milestoned #12041
  • 00:28
    H4CKY54CK commented #12025
  • Dec 13 23:40
    Carreau milestoned #12017
  • Dec 13 18:10
    Carreau commented #12039
  • Dec 13 15:05
    alexmojaki synchronize #11886
  • Dec 13 14:43
    cottrell closed #12040
  • Dec 13 14:43
    cottrell commented #12040
  • Dec 13 14:35
    cottrell commented #12040
  • Dec 13 14:32
    cottrell opened #12040
  • Dec 13 13:04
    ZouLiSha commented #11946
  • Dec 13 05:49
    zhuli19901106 commented #5539
Rohit Kapoor
@algo-circle
Thank you
Harsha Vardhan
@harsha547
@drethegreat11 use jsonify library to convert json to csv, csv to json
Rakesh P
@rp-21
...
Steven Lee
@stevenleeS0ht
Is there a dependency list or requirement description in README.md or anywhere else?
Min RK
@minrk
@stevenleeS0ht dependencies are in setup.py, so pip install . will install any dependencies automatically.
Vidar Tonaas Fauske
@vidartf
Should this work (aka a bug), or is this "as intended":
from IPython.display import display
handle = display(display_id=True)
handle.update('world')
(this shows nothing, as the first display call doesn't actually create an output that is updatable)
Min RK
@minrk
Hm, not sure
Maybe the first call should error with nothing given to display?
Vidar Tonaas Fauske
@vidartf
Would it make sense for it to create an output with an empty bundle, or will that break some assumptions?
I agree it might make sense to error if the display_id arg was also missing, but its presence indicates that some outputs might be given to it later
Min RK
@minrk
yeah, I think it does make sense to do this. Can you tell that it's the display function that's deciding not to send and not the client side?
Vidar Tonaas Fauske
@vidartf
yeah, no display_data message gets sent for the empty one, but I'll make sure to prove by source for a PR
Vidar Tonaas Fauske
@vidartf
fun fact: display(None, 'foo', 'bar', display_id=True) produces:
'bar'
'bar'
'bar'
I guess that one can be written up as "works as expected" if a specific id is given, but maybe not fully intuitive when True is used
Min RK
@minrk
that's...fun
Vidar Tonaas Fauske
@vidartf
BTW, it is possible to get an empty, updatable output with display({}, raw=True, display_id=True)
so I'm thinking to maybe just leave this alone
well, I was thinking that in order to allow for code like display(*possibly_empty_iterable, display_id=True), but that does seem like a weird pattern...
Vidar Tonaas Fauske
@vidartf
it seems classic notebook does filter away empty outputs (e.g. from display({}, raw=True, display_id=True))
biancaisla1
@biancaisla1
Hey everyone, I'm new to python and I have a question that I feel might be an easy one to answer. I know you can create macros that will automatically loop through a specific file type e.g. '.txt'. However, I'm not sure if there is something that will do this in Python? In other words, I'd like to open a specific folder, open a specific file type '.txt', and then run specific commands on that file using different python modules, save out to a new file type '.csv', and then open another '.txt', and repeat the same steps until there are no more files within the folder. Does anyone have a code snippet that does this?
Andrew
@sheerluck
@biancaisla1
import os

def parse(line: str) -> str:
    # TODO
    return line.strip()

def specific_commands(path: str) -> None:
    with open(path, "r") as txt, open(path+".csv", "w") as csv:
        for line in txt:
            csv.write(parse(line) + '\n')

for p, d, files in os.walk("test"):
     for f in files:
         if f.endswith(".txt"):
             path = os.path.join(p, f)
             specific_commands(path)
biancaisla1
@biancaisla1
@sheerluck , thank you! I will play with this and do a little research to make it work!
kdeepak99
@kdeepak99
Guys I am getting below error
Traceback (most recent call last):
File "/usr/local/Cellar/jupyterlab/1.2.0/libexec/bin/jupyter", line 6, in <module>
from pkg_resources import load_entry_point
ModuleNotFoundError: No module named 'pkg_resources'
while starting jupyter notebook
Andrew
@sheerluck
@kdeepak99 reinstall setuptools via package manager
sudo apt install --reinstall python3-pkg-resources
pip install --upgrade setuptools
pip install --upgrade distribute
kdeepak99
@kdeepak99
@sheerluck :: distribute package not able to install and throwing below error.

Collecting distribute
Using cached https://files.pythonhosted.org/packages/5f/ad/1fde06877a8d7d5c9b60eff7de2d452f639916ae1d48f0b8f97bf97e570a/distribute-0.7.3.zip
ERROR: Command errored out with exit status 1:
command: /Library/Frameworks/Python.framework/Versions/3.8/bin/python3.8 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/b3/grhq_y2x6zs35bq7g_0dw1f00000gn/T/pip-install-db0p5lug/distribute/setup.py'"'"'; file='"'"'/private/var/folders/b3/grhq_y2x6zs35bq7g_0dw1f00000gn/T/pip-install-db0p5lug/distribute/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(file);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' egg_info --egg-base /private/var/folders/b3/grhq_y2x6zs35bq7g_0dw1f00000gn/T/pip-install-db0p5lug/distribute/pip-egg-info
cwd: /private/var/folders/b3/grhq_y2x6zs35bq7g_0dw1f00000gn/T/pip-install-db0p5lug/distribute/
Complete output (15 lines):
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/private/var/folders/b3/grhq_y2x6zs35bq7g_0dw1f00000gn/T/pip-install-db0p5lug/distribute/setuptools/init.py", line 2, in <module>
from setuptools.extension import Extension, Library
File "/private/var/folders/b3/grhq_y2x6zs35bq7g_0dw1f00000gn/T/pip-install-db0p5lug/distribute/setuptools/extension.py", line 5, in <module>
from setuptools.dist import _get_unpatched
File "/private/var/folders/b3/grhq_y2x6zs35bq7g_0dw1f00000gn/T/pip-install-db0p5lug/distribute/setuptools/dist.py", line 7, in <module>
from setuptools.command.install import install
File "/private/var/folders/b3/grhq_y2x6zs35bq7g_0dw1f00000gn/T/pip-install-db0p5lug/distribute/setuptools/command/init.py", line 8, in <module>
from setuptools.command import install_scripts
File "/private/var/folders/b3/grhq_y2x6zs35bq7g_0dw1f00000gn/T/pip-install-db0p5lug/distribute/setuptools/command/install_scripts.py", line 3, in <module>
from pkg_resources import Distribution, PathMetadata, ensure_directory
File "/private/var/folders/b3/grhq_y2x6zs35bq7g_0dw1f00000gn/T/pip-install-db0p5lug/distribute/pkg_resources.py", line 1518, in <module>
register_loader_type(importlib_bootstrap.SourceFileLoader, DefaultProvider)

AttributeError: module 'importlib._bootstrap' has no attribute 'SourceFileLoader'
----------------------------------------

ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.

kdeepak99
@kdeepak99
@sheerluck :: Please help me once
Andrew
@sheerluck
whoa
do not install distribute I was wrong :)
kdeepak99
@kdeepak99
okay
but still unable to launch
jupyter
Andrew
@sheerluck
python3.8
kdeepak99
@kdeepak99
yes
python 3.8
Andrew
@sheerluck
no i mean run python3.8 and then from pkg_resources import load_entry_point
kdeepak99
@kdeepak99
no changes observed
Andrew
@sheerluck
def load_entry_point is in pip so run python3.8 -m pip install --upgrade pip
kdeepak99
@kdeepak99
still no changes observed @sheerluck
still its throwing error
Andrew
@sheerluck
well I am just of of new ideas. Maybe create a fresh virtual env and install jupyterlab there from a scratch
coz you current jupyterlab somehow can not see your current pip or something like that
kdeepak99
@kdeepak99
Okay @sheerluck
Thanks for your help
Thomas Arvanitidis
@thomasarvanitidis
Hi. I'm getting an error I didn't use to simply by setting a trace with ipdb https://bpaste.net/show/NXV5Q . Anybody has any ideas?
Thomas Arvanitidis
@thomasarvanitidis
Actually, this is a clearer picture of the problem https://bpaste.net/show/6XEY4