workspace stringclasses 1
value | channel stringclasses 1
value | sentences stringlengths 1 3.93k | ts stringlengths 26 26 | user stringlengths 2 11 | sentence_id stringlengths 44 53 | timestamp float64 1.5B 1.56B | __index_level_0__ int64 0 106k |
|---|---|---|---|---|---|---|---|
pythondev | help | your imports seems to be commented out | 2017-09-03T16:56:20.000100 | Ciera | pythondev_help_Ciera_2017-09-03T16:56:20.000100 | 1,504,457,780.0001 | 92,003 |
pythondev | help | `from urllib.request import urlopen` | 2017-09-03T16:56:42.000036 | Ciera | pythondev_help_Ciera_2017-09-03T16:56:42.000036 | 1,504,457,802.000036 | 92,004 |
pythondev | help | ```
import webbrowser
import jsonfrom urllib.request import urlopen
print("Let's find an old website.")
site = input("Type a website URL: ")
era = input("Type a year, month, and day, like 20150613: ")
url = "<http://archive.org/wayback/available?url=%s&timestamp=%s>" % (site, era)
response = urlopen(url)
content = response.read()
text = contents.decode("utf-8")
data = json.loads(text)
try:
old_site = data["archived_snapshots"]["closest"]["url"]
print("Found this copy: ", old_site)
print("It should appear in your browser now.")
webbrowser.open(old_site)
except:
print("Sorry, no luck finding", site)
``` | 2017-09-03T16:56:56.000092 | Carlene | pythondev_help_Carlene_2017-09-03T16:56:56.000092 | 1,504,457,816.000092 | 92,005 |
pythondev | help | I just noticed that too | 2017-09-03T16:57:02.000061 | Carlene | pythondev_help_Carlene_2017-09-03T16:57:02.000061 | 1,504,457,822.000061 | 92,006 |
pythondev | help | btw I recommend you to use this module `requests` to do http calls it's a lot easier | 2017-09-03T16:57:47.000009 | Ciera | pythondev_help_Ciera_2017-09-03T16:57:47.000009 | 1,504,457,867.000009 | 92,007 |
pythondev | help | where would I use this? I am extremely new to python | 2017-09-03T16:58:04.000082 | Carlene | pythondev_help_Carlene_2017-09-03T16:58:04.000082 | 1,504,457,884.000082 | 92,008 |
pythondev | help | and I haven't coded in YEARS | 2017-09-03T16:58:12.000059 | Carlene | pythondev_help_Carlene_2017-09-03T16:58:12.000059 | 1,504,457,892.000059 | 92,009 |
pythondev | help | the documentation is pretty straightforward | 2017-09-03T16:59:10.000091 | Ciera | pythondev_help_Ciera_2017-09-03T16:59:10.000091 | 1,504,457,950.000091 | 92,010 |
pythondev | help | <http://docs.python-requests.org/en/master/> | 2017-09-03T16:59:11.000067 | Ciera | pythondev_help_Ciera_2017-09-03T16:59:11.000067 | 1,504,457,951.000067 | 92,011 |
pythondev | help | but if you are following a book it might be better to follow what it says. It depends how you like to learn :slightly_smiling_face: | 2017-09-03T16:59:39.000025 | Ciera | pythondev_help_Ciera_2017-09-03T16:59:39.000025 | 1,504,457,979.000025 | 92,012 |
pythondev | help | I am open to learning various ways. I am typing exactly what the books says but the program isn't interpreting correctly | 2017-09-03T17:01:02.000001 | Carlene | pythondev_help_Carlene_2017-09-03T17:01:02.000001 | 1,504,458,062.000001 | 92,013 |
pythondev | help | what's the error ? | 2017-09-03T17:01:39.000014 | Ciera | pythondev_help_Ciera_2017-09-03T17:01:39.000014 | 1,504,458,099.000014 | 92,014 |
pythondev | help | maybe once you have made the book version try to rewrite it using requests | 2017-09-03T17:02:01.000025 | Ciera | pythondev_help_Ciera_2017-09-03T17:02:01.000025 | 1,504,458,121.000025 | 92,015 |
pythondev | help | ```
Traceback (most recent call last):
File "archive.py", line 8, in <module>
response = urlopen(url)
NameError: name 'urlopen' is not defined
``` | 2017-09-03T17:02:20.000060 | Carlene | pythondev_help_Carlene_2017-09-03T17:02:20.000060 | 1,504,458,140.00006 | 92,016 |
pythondev | help | `import jsonfrom urllib.request import urlopen` this should be on two lines | 2017-09-03T17:02:44.000042 | Ciera | pythondev_help_Ciera_2017-09-03T17:02:44.000042 | 1,504,458,164.000042 | 92,017 |
pythondev | help | terminal is coming back with a syntax error: urllib.request | 2017-09-03T17:04:43.000094 | Carlene | pythondev_help_Carlene_2017-09-03T17:04:43.000094 | 1,504,458,283.000094 | 92,018 |
pythondev | help | python3 ? | 2017-09-03T17:08:37.000021 | Ciera | pythondev_help_Ciera_2017-09-03T17:08:37.000021 | 1,504,458,517.000021 | 92,019 |
pythondev | help | ```
Python 3.6.2 (default, Aug 7 2017, 10:49:43)
[GCC 5.4.0 20160609] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from urllib.request import urlopen
>>> urlopen('<http://www.google.be>')
<http.client.HTTPResponse object at 0x7f528a1fb940>
>>>
``` | 2017-09-03T17:09:37.000059 | Ciera | pythondev_help_Ciera_2017-09-03T17:09:37.000059 | 1,504,458,577.000059 | 92,020 |
pythondev | help | I am running it via python 3.5 | 2017-09-03T17:16:59.000018 | Carlene | pythondev_help_Carlene_2017-09-03T17:16:59.000018 | 1,504,459,019.000018 | 92,021 |
pythondev | help | I have Python 3.5.2 :: Anaconda 4.2.0 (x86_64) | 2017-09-03T17:18:08.000032 | Carlene | pythondev_help_Carlene_2017-09-03T17:18:08.000032 | 1,504,459,088.000032 | 92,022 |
pythondev | help | MacOS 10.12 | 2017-09-03T17:18:30.000083 | Carlene | pythondev_help_Carlene_2017-09-03T17:18:30.000083 | 1,504,459,110.000083 | 92,023 |
pythondev | help | hmm I don't know. Does a simple import of `urllib` works ? | 2017-09-03T17:22:14.000061 | Ciera | pythondev_help_Ciera_2017-09-03T17:22:14.000061 | 1,504,459,334.000061 | 92,024 |
pythondev | help | <@Suellen> :taco: Thanks for the link for `http.server`. That seems to do what I want. | 2017-09-03T20:52:06.000017 | Sidney | pythondev_help_Sidney_2017-09-03T20:52:06.000017 | 1,504,471,926.000017 | 92,025 |
pythondev | help | Hi All anyone online currently? | 2017-09-03T21:11:30.000011 | Carlene | pythondev_help_Carlene_2017-09-03T21:11:30.000011 | 1,504,473,090.000011 | 92,026 |
pythondev | help | <@Carlene> Yup | 2017-09-04T00:18:30.000106 | Shelly | pythondev_help_Shelly_2017-09-04T00:18:30.000106 | 1,504,484,310.000106 | 92,027 |
pythondev | help | ```import webbrowser
import json
import requests
print("Let's find an old website.")
site = input("Type a website URL: ")
era = input("Type a year, month, and day, like 20150613: ")
url = "<http://archive.org/wayback/available?url=%s&timestamp=%s>" % (site, era)
response = requests.get(url)
data = response.json()
try:
old_site = data["archived_snapshots"]["closest"]["url"]
print("Found this copy: ", old_site)
print("It should appear in your browser now.")
webbrowser.open(old_site)
except:
print("Sorry, no luck finding", site)```
Made few changes, this should work. | 2017-09-04T00:23:45.000093 | Shelly | pythondev_help_Shelly_2017-09-04T00:23:45.000093 | 1,504,484,625.000093 | 92,028 |
pythondev | help | <@Shelly> oh Hello! Thank you very much! | 2017-09-04T02:06:30.000040 | Carlene | pythondev_help_Carlene_2017-09-04T02:06:30.000040 | 1,504,490,790.00004 | 92,029 |
pythondev | help | Can you please tell me what changes you made? This is very new to me | 2017-09-04T02:06:40.000017 | Carlene | pythondev_help_Carlene_2017-09-04T02:06:40.000017 | 1,504,490,800.000017 | 92,030 |
pythondev | help | `import requests` in place of `from urllib.request import urlopen` | 2017-09-04T02:08:01.000178 | Shelly | pythondev_help_Shelly_2017-09-04T02:08:01.000178 | 1,504,490,881.000178 | 92,031 |
pythondev | help | ```
Traceback (most recent call last):
File "/Users/tanuja/Desktop/IntrotoPython/archive2.py", line 3, in <module>
import requests
ImportError: No module named 'requests'
``` | 2017-09-04T02:08:11.000040 | Carlene | pythondev_help_Carlene_2017-09-04T02:08:11.000040 | 1,504,490,891.00004 | 92,032 |
pythondev | help | why am I getting this error | 2017-09-04T02:08:31.000195 | Carlene | pythondev_help_Carlene_2017-09-04T02:08:31.000195 | 1,504,490,911.000195 | 92,033 |
pythondev | help | `requests` package is not installed, do `pip install requests` | 2017-09-04T02:08:45.000154 | Shelly | pythondev_help_Shelly_2017-09-04T02:08:45.000154 | 1,504,490,925.000154 | 92,034 |
pythondev | help | WORKED like a charm, and thank you!! | 2017-09-04T02:39:32.000087 | Carlene | pythondev_help_Carlene_2017-09-04T02:39:32.000087 | 1,504,492,772.000087 | 92,035 |
pythondev | help | what is the diff from import requests to urllib.request import urlopen? | 2017-09-04T02:39:56.000112 | Carlene | pythondev_help_Carlene_2017-09-04T02:39:56.000112 | 1,504,492,796.000112 | 92,036 |
pythondev | help | <@Shelly> | 2017-09-04T02:39:59.000235 | Carlene | pythondev_help_Carlene_2017-09-04T02:39:59.000235 | 1,504,492,799.000235 | 92,037 |
pythondev | help | `urllib.request.urlopen` is a library that comes with python, while `requests` is a package created by a third party developer | 2017-09-04T02:49:54.000253 | Marcie | pythondev_help_Marcie_2017-09-04T02:49:54.000253 | 1,504,493,394.000253 | 92,038 |
pythondev | help | they both do the same thing at the very core (deal with http), but requests is a much much easier package to use | 2017-09-04T02:50:17.000078 | Marcie | pythondev_help_Marcie_2017-09-04T02:50:17.000078 | 1,504,493,417.000078 | 92,039 |
pythondev | help | I am facing issue in Converting iPython Notebook file to PDF
I have posted question on Stackoverflow but no response till now
Please help
Stackoverflow Question Link
<https://stackoverflow.com/questions/43247818/error-in-converting-ipython-notebook-file-to-pdf> | 2017-09-04T04:04:23.000265 | Shaniqua | pythondev_help_Shaniqua_2017-09-04T04:04:23.000265 | 1,504,497,863.000265 | 92,040 |
pythondev | help | Could someone explain this whole tox.ini thing? Is that just for linters and coverage? Will mypy follow it? Is it deprecated? | 2017-09-04T08:49:33.000246 | Lanita | pythondev_help_Lanita_2017-09-04T08:49:33.000246 | 1,504,514,973.000246 | 92,041 |
pythondev | help | <https://tox.readthedocs.io/en/latest/> seems to make it like tox is all about unit testing | 2017-09-04T08:50:11.000209 | Lanita | pythondev_help_Lanita_2017-09-04T08:50:11.000209 | 1,504,515,011.000209 | 92,042 |
pythondev | help | It's useful when you need to test your codebase against a matrix of dependencies | 2017-09-04T08:50:43.000194 | Suellen | pythondev_help_Suellen_2017-09-04T08:50:43.000194 | 1,504,515,043.000194 | 92,043 |
pythondev | help | i.e. you webapp supports Django 1.11, 1.10 and 1.9; and it also works with Python 2.7 and 3.3+ | 2017-09-04T08:51:16.000113 | Suellen | pythondev_help_Suellen_2017-09-04T08:51:16.000113 | 1,504,515,076.000113 | 92,044 |
pythondev | help | just `make test` or `py.test` will only test against your current configuration | 2017-09-04T08:51:42.000436 | Suellen | pythondev_help_Suellen_2017-09-04T08:51:42.000436 | 1,504,515,102.000436 | 92,045 |
pythondev | help | or to run multiple test one after another :slightly_smiling_face: | 2017-09-04T08:51:55.000232 | Ciera | pythondev_help_Ciera_2017-09-04T08:51:55.000232 | 1,504,515,115.000232 | 92,046 |
pythondev | help | Right now, with my django tests, I'm using manage.py test, but that's inside of the env. I guess you'd use tox as an alternative to starting a specific venv and running the tests | 2017-09-04T08:53:11.000038 | Lanita | pythondev_help_Lanita_2017-09-04T08:53:11.000038 | 1,504,515,191.000038 | 92,047 |
pythondev | help | What confused me intiially is that I do use a tox.ini file, but only for flake8 ignores and coverage omit's | 2017-09-04T08:53:32.000237 | Lanita | pythondev_help_Lanita_2017-09-04T08:53:32.000237 | 1,504,515,212.000237 | 92,048 |
pythondev | help | but I can't seem to use it for mypy, I need a mypy.ini for that | 2017-09-04T08:53:54.000220 | Lanita | pythondev_help_Lanita_2017-09-04T08:53:54.000220 | 1,504,515,234.00022 | 92,049 |
pythondev | help | as tox is widely use some tools allow you to put their configuration inside the `tox.ini` file to limit the number of configuration file | 2017-09-04T08:55:12.000011 | Ciera | pythondev_help_Ciera_2017-09-04T08:55:12.000011 | 1,504,515,312.000011 | 92,050 |
pythondev | help | I have no idea if mypy allow that | 2017-09-04T08:55:22.000117 | Ciera | pythondev_help_Ciera_2017-09-04T08:55:22.000117 | 1,504,515,322.000117 | 92,051 |
pythondev | help | there might be a command line arg to pass the configuration file | 2017-09-04T08:55:34.000041 | Ciera | pythondev_help_Ciera_2017-09-04T08:55:34.000041 | 1,504,515,334.000041 | 92,052 |
pythondev | help | Mypy could easily add pattern matching for that, but I don't think it does | 2017-09-04T08:55:37.000434 | Lanita | pythondev_help_Lanita_2017-09-04T08:55:37.000434 | 1,504,515,337.000434 | 92,053 |
pythondev | help | (hard to prove a negative :)) | 2017-09-04T08:55:47.000104 | Lanita | pythondev_help_Lanita_2017-09-04T08:55:47.000104 | 1,504,515,347.000104 | 92,054 |
pythondev | help | <https://github.com/python/mypy/pull/2761> | 2017-09-04T08:56:54.000001 | Ciera | pythondev_help_Ciera_2017-09-04T08:56:54.000001 | 1,504,515,414.000001 | 92,055 |
pythondev | help | so it's seem :bdfl: was against it in the beginning then change his mind | 2017-09-04T08:58:19.000450 | Ciera | pythondev_help_Ciera_2017-09-04T08:58:19.000450 | 1,504,515,499.00045 | 92,056 |
pythondev | help | His opinion certainly is reasonable | 2017-09-04T09:00:29.000032 | Lanita | pythondev_help_Lanita_2017-09-04T09:00:29.000032 | 1,504,515,629.000032 | 92,057 |
pythondev | help | btw, separate topic, why do so many programs not come with man pages? Have nobody done it yet, or are people against it? (thiis is a very general question) | 2017-09-04T09:01:57.000263 | Lanita | pythondev_help_Lanita_2017-09-04T09:01:57.000263 | 1,504,515,717.000263 | 92,058 |
pythondev | help | python program ? or in general ? | 2017-09-04T09:02:41.000214 | Ciera | pythondev_help_Ciera_2017-09-04T09:02:41.000214 | 1,504,515,761.000214 | 92,059 |
pythondev | help | in general | 2017-09-04T09:02:44.000398 | Lanita | pythondev_help_Lanita_2017-09-04T09:02:44.000398 | 1,504,515,764.000398 | 92,060 |
pythondev | help | nobody :nose: | 2017-09-04T09:02:51.000204 | Suellen | pythondev_help_Suellen_2017-09-04T09:02:51.000204 | 1,504,515,771.000204 | 92,061 |
pythondev | help | for mypy for example, guido himself said "no it's too complicated" here: <https://github.com/python/mypy/issues/2599>
but there's a thousand big projects missing manpages | 2017-09-04T09:03:19.000045 | Lanita | pythondev_help_Lanita_2017-09-04T09:03:19.000045 | 1,504,515,799.000045 | 92,062 |
pythondev | help | (not literally "too complicated") | 2017-09-04T09:03:46.000376 | Lanita | pythondev_help_Lanita_2017-09-04T09:03:46.000376 | 1,504,515,826.000376 | 92,063 |
pythondev | help | well if it's for using the output of the `--help` I don't really see a need | 2017-09-04T09:04:51.000197 | Ciera | pythondev_help_Ciera_2017-09-04T09:04:51.000197 | 1,504,515,891.000197 | 92,064 |
pythondev | help | and as he said it creates more complexity to release | 2017-09-04T09:05:30.000354 | Ciera | pythondev_help_Ciera_2017-09-04T09:05:30.000354 | 1,504,515,930.000354 | 92,065 |
pythondev | help | maybe if there was a way to generate man page from sphinx doc | 2017-09-04T09:06:07.000253 | Ciera | pythondev_help_Ciera_2017-09-04T09:06:07.000253 | 1,504,515,967.000253 | 92,066 |
pythondev | help | FYI: <https://github.com/pyslackers/community/blob/master/introduction.md#taco-bot-taco> | 2017-09-04T10:55:19.000238 | Deedee | pythondev_help_Deedee_2017-09-04T10:55:19.000238 | 1,504,522,519.000238 | 92,067 |
pythondev | help | Hi there, I'm kinda new in the "do the stuff by yourself". Since I broke up with school books and tasks so, I started a little project in Python, a Bible Verse Searcher (It's my first Python Project, and it will be donated to my local church, ¡Yay!)...
Apart from the boring part, I'm trying to parse the XML of the Bible in a Finder class, but I got this:
```Traceback (most recent call last):
File "Documents/Universidad/Python/Bible/BibleSearcher.py", line 4, in <module>
class Finder():
File "Documents/Universidad/Python/Bible/BibleSearcher.py", line 6, in Finder
tree = et.parse('RVR1960.xml')
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/xml/etree/ElementTree.py"
, line 1196, in parse
tree.parse(source, parser)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/xml/etree/ElementTree.py"
, line 586, in parse
source = open(source, "rb")
FileNotFoundError: [Errno 2] No such file or directory: 'RVR1960.xml' ```
You can say, "You don't have the freaking XML in the same folder, you big dummy!" but I have it, actually. Do you have an idea what's going on here? | 2017-09-04T12:35:27.000021 | Lana | pythondev_help_Lana_2017-09-04T12:35:27.000021 | 1,504,528,527.000021 | 92,068 |
pythondev | help | And, if someone has ideas to make this program interesting (functionality) I'll be thankful if you share them with me, :smile: | 2017-09-04T12:37:13.000170 | Lana | pythondev_help_Lana_2017-09-04T12:37:13.000170 | 1,504,528,633.00017 | 92,069 |
pythondev | help | The XML might be in the _same_ folder, but that isn't necessarily the folder that the program is running from | 2017-09-04T12:37:15.000116 | Gabriele | pythondev_help_Gabriele_2017-09-04T12:37:15.000116 | 1,504,528,635.000116 | 92,070 |
pythondev | help | So, full path is the solution? | 2017-09-04T12:37:37.000002 | Lana | pythondev_help_Lana_2017-09-04T12:37:37.000002 | 1,504,528,657.000002 | 92,071 |
pythondev | help | Maybe | 2017-09-04T12:37:59.000022 | Gabriele | pythondev_help_Gabriele_2017-09-04T12:37:59.000022 | 1,504,528,679.000022 | 92,072 |
pythondev | help | You get to decide where you run a program from. | 2017-09-04T12:38:04.000078 | Gabriele | pythondev_help_Gabriele_2017-09-04T12:38:04.000078 | 1,504,528,684.000078 | 92,073 |
pythondev | help | full path is always better :slightly_smiling_face: | 2017-09-04T12:38:11.000178 | Ciera | pythondev_help_Ciera_2017-09-04T12:38:11.000178 | 1,504,528,691.000178 | 92,074 |
pythondev | help | Well, I got this: ```FileNotFoundError: [Errno 2] No such file or directory: '~/Documents/Universidad/Pyhon/Bible/RVR1
960.xml' ``` | 2017-09-04T12:39:08.000075 | Lana | pythondev_help_Lana_2017-09-04T12:39:08.000075 | 1,504,528,748.000075 | 92,075 |
pythondev | help | typo | 2017-09-04T12:39:55.000102 | Gabriele | pythondev_help_Gabriele_2017-09-04T12:39:55.000102 | 1,504,528,795.000102 | 92,076 |
pythondev | help | I don't get this... :disappointed: | 2017-09-04T12:40:24.000040 | Lana | pythondev_help_Lana_2017-09-04T12:40:24.000040 | 1,504,528,824.00004 | 92,077 |
pythondev | help | Pyhon vs. Python | 2017-09-04T12:40:57.000169 | Gabriele | pythondev_help_Gabriele_2017-09-04T12:40:57.000169 | 1,504,528,857.000169 | 92,078 |
pythondev | help | Still not getting it :S | 2017-09-04T12:41:27.000177 | Lana | pythondev_help_Lana_2017-09-04T12:41:27.000177 | 1,504,528,887.000177 | 92,079 |
pythondev | help | you have typed the path incorrectly | 2017-09-04T12:42:07.000059 | Gabriele | pythondev_help_Gabriele_2017-09-04T12:42:07.000059 | 1,504,528,927.000059 | 92,080 |
pythondev | help | Well, You have to know, I'm not running it whitin a venv :see_no_evil: | 2017-09-04T12:42:10.000139 | Lana | pythondev_help_Lana_2017-09-04T12:42:10.000139 | 1,504,528,930.000139 | 92,081 |
pythondev | help | Oh | 2017-09-04T12:42:17.000234 | Lana | pythondev_help_Lana_2017-09-04T12:42:17.000234 | 1,504,528,937.000234 | 92,082 |
pythondev | help | which is at least one argument against using a full path | 2017-09-04T12:42:19.000096 | Gabriele | pythondev_help_Gabriele_2017-09-04T12:42:19.000096 | 1,504,528,939.000096 | 92,083 |
pythondev | help | You think maybe a solution could be setting up a venv? | 2017-09-04T12:43:33.000087 | Lana | pythondev_help_Lana_2017-09-04T12:43:33.000087 | 1,504,529,013.000087 | 92,084 |
pythondev | help | Or makes no difference :confused: | 2017-09-04T12:43:42.000116 | Lana | pythondev_help_Lana_2017-09-04T12:43:42.000116 | 1,504,529,022.000116 | 92,085 |
pythondev | help | Your most immediate solution is just to type that path out correctly. | 2017-09-04T12:46:26.000135 | Gabriele | pythondev_help_Gabriele_2017-09-04T12:46:26.000135 | 1,504,529,186.000135 | 92,086 |
pythondev | help | Your second solution is to work out why you seem to be running the program from somewhere other than where the XML file is. | 2017-09-04T12:46:44.000014 | Gabriele | pythondev_help_Gabriele_2017-09-04T12:46:44.000014 | 1,504,529,204.000014 | 92,087 |
pythondev | help | Ok I found the full path, thanks... Tacos but, still thinking about the venv, maybe that's a better solution (beginner with that stuff, don't know if the venv really matters) | 2017-09-04T12:49:32.000254 | Lana | pythondev_help_Lana_2017-09-04T12:49:32.000254 | 1,504,529,372.000254 | 92,088 |
pythondev | help | :taco: <@Gabriele> | 2017-09-04T12:49:40.000193 | Lana | pythondev_help_Lana_2017-09-04T12:49:40.000193 | 1,504,529,380.000193 | 92,089 |
pythondev | help | And, if yes, I have a serious problem because I just moved from atom to MacVim :S | 2017-09-04T12:50:14.000116 | Lana | pythondev_help_Lana_2017-09-04T12:50:14.000116 | 1,504,529,414.000116 | 92,090 |
pythondev | help | And I'm kinda new using it so, I don't know anything about running venv's in vim. | 2017-09-04T12:50:50.000191 | Lana | pythondev_help_Lana_2017-09-04T12:50:50.000191 | 1,504,529,450.000191 | 92,091 |
pythondev | help | Virtualenvs wouldn't really change the nature of this problem. Mostly it just ensures that your libraries are exactly what you want them to be. | 2017-09-04T12:50:52.000115 | Gabriele | pythondev_help_Gabriele_2017-09-04T12:50:52.000115 | 1,504,529,452.000115 | 92,092 |
pythondev | help | Oh, nevermind then... Thanks again, bro | 2017-09-04T12:53:21.000151 | Lana | pythondev_help_Lana_2017-09-04T12:53:21.000151 | 1,504,529,601.000151 | 92,093 |
pythondev | help | Ok, another question (I really need to wonder if I really learned Python)... Uhhh | 2017-09-04T13:05:56.000221 | Lana | pythondev_help_Lana_2017-09-04T13:05:56.000221 | 1,504,530,356.000221 | 92,094 |
pythondev | help | I have this:
```import xml.etree.ElementTree as et
class Finder():
version = 'RVR1960' # Default version in Spanish Bible
tree = et.parse('/Users/alfonsoima/Documents/Universidad/Python/Bible/RVR1960.xml')
bible = tree.getroot()
def __init__(self):
pass
def find(book = "Génesis", chv = "1:1"):
try:
cha, ver = chv.split(':')
except:
cha = chv
ver = '1'
finally:
return bible.find('./b[@n="{}"]/c[@n="{}"]/v[@n="{}"]'.format(book, cha, ver))
```
And the shell prompts this:
`NameError: name 'bible' is not defined ` | 2017-09-04T13:06:59.000082 | Lana | pythondev_help_Lana_2017-09-04T13:06:59.000082 | 1,504,530,419.000082 | 92,095 |
pythondev | help | So, I tried with the `global bible` then `return bible.find(args)` but still didn't work. | 2017-09-04T13:08:22.000039 | Lana | pythondev_help_Lana_2017-09-04T13:08:22.000039 | 1,504,530,502.000039 | 92,096 |
pythondev | help | And `self.bible` neither works. | 2017-09-04T13:08:53.000184 | Lana | pythondev_help_Lana_2017-09-04T13:08:53.000184 | 1,504,530,533.000184 | 92,097 |
pythondev | help | your class isn’t being created properly. Your `def find()` method has no ‘self’ being passed into it so it would need to be decorated with `@staticmethod`. | 2017-09-04T13:13:54.000032 | Johana | pythondev_help_Johana_2017-09-04T13:13:54.000032 | 1,504,530,834.000032 | 92,098 |
pythondev | help | i would suggest structuring you class a little differently. I would pass in that full path like so
```
class Finder(object):
def __init__(self, version, xml_path):
self.version = version
self.xml_path = xml_path
self.tree = et.parse(xml_path)
self.bible = tree.getroot()
def find(self, book, chv):
try:
cha, ver chv.split()
except SomeError:
cha = chv
ver = '1'
finally:
. . .
``` | 2017-09-04T13:18:01.000062 | Johana | pythondev_help_Johana_2017-09-04T13:18:01.000062 | 1,504,531,081.000062 | 92,099 |
pythondev | help | then you can do
```
finder = Finder('1.0', '/path/to/xml_file.xml')
book = finder.find(book='Genesis', chv='1:1')
``` | 2017-09-04T13:19:53.000148 | Johana | pythondev_help_Johana_2017-09-04T13:19:53.000148 | 1,504,531,193.000148 | 92,100 |
pythondev | help | <@Lana> :point_up: | 2017-09-04T13:21:13.000140 | Johana | pythondev_help_Johana_2017-09-04T13:21:13.000140 | 1,504,531,273.00014 | 92,101 |
pythondev | help | Why am I so bad structuring this stuff while you guys are awesome? | 2017-09-04T13:22:12.000134 | Lana | pythondev_help_Lana_2017-09-04T13:22:12.000134 | 1,504,531,332.000134 | 92,102 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.