Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #75639 > unrolled thread

CodeSkulptor

Started bySeymore4Head <Seymore4Head@Hotmail.invalid>
First post2014-08-03 21:06 -0400
Last post2014-08-04 03:02 -0400
Articles 16 — 7 participants

Back to article view | Back to comp.lang.python


Contents

  CodeSkulptor Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-08-03 21:06 -0400
    Re: CodeSkulptor Mark Lawrence <breamoreboy@yahoo.co.uk> - 2014-08-04 02:21 +0100
    Re: CodeSkulptor Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-08-04 11:29 +1000
      Re: CodeSkulptor Chris Angelico <rosuav@gmail.com> - 2014-08-04 11:43 +1000
        Re: CodeSkulptor Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-08-03 22:08 -0400
          Re: CodeSkulptor Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-08-03 22:38 -0400
            Re: CodeSkulptor Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-08-04 13:03 +1000
              Re: CodeSkulptor Chris Angelico <rosuav@gmail.com> - 2014-08-04 13:09 +1000
              Re: CodeSkulptor Peter Otten <__peter__@web.de> - 2014-08-04 14:39 +0200
              Re: CodeSkulptor Chris Angelico <rosuav@gmail.com> - 2014-08-05 00:18 +1000
            Re: CodeSkulptor Chris Angelico <rosuav@gmail.com> - 2014-08-04 13:05 +1000
          Re: CodeSkulptor Chris “Kwpolska” Warrick <kwpolska@gmail.com> - 2014-08-04 10:26 +0200
      Re: CodeSkulptor Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-08-03 21:41 -0400
        Re: CodeSkulptor Mark Lawrence <breamoreboy@yahoo.co.uk> - 2014-08-04 02:56 +0100
          Re: CodeSkulptor Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-08-03 22:07 -0400
            Re: CodeSkulptor Terry Reedy <tjreedy@udel.edu> - 2014-08-04 03:02 -0400

#75639 — CodeSkulptor

FromSeymore4Head <Seymore4Head@Hotmail.invalid>
Date2014-08-03 21:06 -0400
SubjectCodeSkulptor
Message-ID<pkmtt9135hrbk9l7u3bq9no55ttok69q3p@4ax.com>
I am very new to Python.
Right now I am using two tools.
I am trying the tutorials at codecademy.com which is walking me
through it pretty slow.
The second thing I am doing is using codeskulptor to try out a few
things I have learned at codecademy.

I am getting a mismatch.

The example I am working on is:
(codecademy)
from datetime import datetime
now = datetime.now()

current_year = now.year
current_month = now.month
current_day = now.day

Putting that in codeskulptor gets

Line 4: ImportError: No module named datetime

The commands I am used to in codeskulptor is something like
import random
import math
import simplegui
import datetime  <   Changing this to import instead of
from datetime import datetime
still doesn't work.

[toc] | [next] | [standalone]


#75642

FromMark Lawrence <breamoreboy@yahoo.co.uk>
Date2014-08-04 02:21 +0100
Message-ID<mailman.12610.1407115315.18130.python-list@python.org>
In reply to#75639
On 04/08/2014 02:06, Seymore4Head wrote:
> I am very new to Python.
> Right now I am using two tools.
> I am trying the tutorials at codecademy.com which is walking me
> through it pretty slow.
> The second thing I am doing is using codeskulptor to try out a few
> things I have learned at codecademy.
>
> I am getting a mismatch.
>
> The example I am working on is:
> (codecademy)
> from datetime import datetime
> now = datetime.now()
>
> current_year = now.year
> current_month = now.month
> current_day = now.day
>
> Putting that in codeskulptor gets
>
> Line 4: ImportError: No module named datetime
>
> The commands I am used to in codeskulptor is something like
> import random
> import math
> import simplegui
> import datetime  <   Changing this to import instead of
> from datetime import datetime
> still doesn't work.
>

Please define "still doesn't work" as my crystal ball has broken down 
and been sent for repair.

-- 
My fellow Pythonistas, ask not what our language can do for you, ask
what you can do for our language.

Mark Lawrence

[toc] | [prev] | [next] | [standalone]


#75643

FromSteven D'Aprano <steve+comp.lang.python@pearwood.info>
Date2014-08-04 11:29 +1000
Message-ID<53dee1e2$0$9505$c3e8da3$5496439d@news.astraweb.com>
In reply to#75639
Seymore4Head wrote:

[...]
> The second thing I am doing is using codeskulptor to try out a few
> things I have learned at codecademy.

What's CodeSkulptor?

> Putting that in codeskulptor gets
> 
> Line 4: ImportError: No module named datetime

Well that's a bug in CodeSkultor. datetime is a standard Python library, if
CodeSkulptor doesn't provide it, that's a serious bug.



-- 
Steven

[toc] | [prev] | [next] | [standalone]


#75645

FromChris Angelico <rosuav@gmail.com>
Date2014-08-04 11:43 +1000
Message-ID<mailman.12611.1407116631.18130.python-list@python.org>
In reply to#75643
On Mon, Aug 4, 2014 at 11:29 AM, Steven D'Aprano
<steve+comp.lang.python@pearwood.info> wrote:
>> Putting that in codeskulptor gets
>>
>> Line 4: ImportError: No module named datetime
>
> Well that's a bug in CodeSkultor. datetime is a standard Python library, if
> CodeSkulptor doesn't provide it, that's a serious bug.

I think it's not a bug, but a restriction; since it's letting you run
code on their server, and since Python sandboxing is a hard problem,
CodeSkulptor cuts down the available modules. From the docs:

http://www.codeskulptor.org/docs.html#tabs-Python
"""
CodeSkulptor implements the following subset of the Python standard
library. To use these operations, first import the relevant module
with an import statement, such asimport math.
"""

Solution: Don't try to run Python code in your browser, but download
and install an actual interpreter.

ChrisA

[toc] | [prev] | [next] | [standalone]


#75649

FromSeymore4Head <Seymore4Head@Hotmail.invalid>
Date2014-08-03 22:08 -0400
Message-ID<cnqtt95jk1sggn64dtg73r8ccb6ieiq5n4@4ax.com>
In reply to#75645
On Mon, 4 Aug 2014 11:43:48 +1000, Chris Angelico <rosuav@gmail.com>
wrote:

>On Mon, Aug 4, 2014 at 11:29 AM, Steven D'Aprano
><steve+comp.lang.python@pearwood.info> wrote:
>>> Putting that in codeskulptor gets
>>>
>>> Line 4: ImportError: No module named datetime
>>
>> Well that's a bug in CodeSkultor. datetime is a standard Python library, if
>> CodeSkulptor doesn't provide it, that's a serious bug.
>
>I think it's not a bug, but a restriction; since it's letting you run
>code on their server, and since Python sandboxing is a hard problem,
>CodeSkulptor cuts down the available modules. From the docs:
>
>http://www.codeskulptor.org/docs.html#tabs-Python
>"""
>CodeSkulptor implements the following subset of the Python standard
>library. To use these operations, first import the relevant module
>with an import statement, such asimport math.
>"""
>
>Solution: Don't try to run Python code in your browser, but download
>and install an actual interpreter.
>
>ChrisA

I am just going to run 3.3 remotely.
Thanks

[toc] | [prev] | [next] | [standalone]


#75652

FromSeymore4Head <Seymore4Head@Hotmail.invalid>
Date2014-08-03 22:38 -0400
Message-ID<5gstt9lf3ui5r6novjof9k0mnim3rqqlhl@4ax.com>
In reply to#75649
On Sun, 03 Aug 2014 22:08:21 -0400, Seymore4Head
<Seymore4Head@Hotmail.invalid> wrote:

>On Mon, 4 Aug 2014 11:43:48 +1000, Chris Angelico <rosuav@gmail.com>
>wrote:
>
>>On Mon, Aug 4, 2014 at 11:29 AM, Steven D'Aprano
>><steve+comp.lang.python@pearwood.info> wrote:
>>>> Putting that in codeskulptor gets
>>>>
>>>> Line 4: ImportError: No module named datetime
>>>
>>> Well that's a bug in CodeSkultor. datetime is a standard Python library, if
>>> CodeSkulptor doesn't provide it, that's a serious bug.
>>
>>I think it's not a bug, but a restriction; since it's letting you run
>>code on their server, and since Python sandboxing is a hard problem,
>>CodeSkulptor cuts down the available modules. From the docs:
>>
>>http://www.codeskulptor.org/docs.html#tabs-Python
>>
BTW   Just read the instructions seems like a daunting task at the
moment.  You knew what instructions you were looking for.  I am
clueless.

Like running Doom
doom.exe -noidea
 :)

>>CodeSkulptor implements the following subset of the Python standard
>>library. To use these operations, first import the relevant module
>>with an import statement, such asimport math.
>>"""
>>
>>Solution: Don't try to run Python code in your browser, but download
>>and install an actual interpreter.
>>
>>ChrisA
>
>I am just going to run 3.3 remotely.
>Thanks

[toc] | [prev] | [next] | [standalone]


#75654

FromSteven D'Aprano <steve+comp.lang.python@pearwood.info>
Date2014-08-04 13:03 +1000
Message-ID<53def7fe$0$29974$c3e8da3$5496439d@news.astraweb.com>
In reply to#75652
Seymore4Head wrote:

> On Sun, 03 Aug 2014 22:08:21 -0400, Seymore4Head
> <Seymore4Head@Hotmail.invalid> wrote:
> 
>>On Mon, 4 Aug 2014 11:43:48 +1000, Chris Angelico <rosuav@gmail.com>
>>wrote:
>>
>>>On Mon, Aug 4, 2014 at 11:29 AM, Steven D'Aprano
>>><steve+comp.lang.python@pearwood.info> wrote:
>>>>> Putting that in codeskulptor gets
>>>>>
>>>>> Line 4: ImportError: No module named datetime
>>>>
>>>> Well that's a bug in CodeSkultor. datetime is a standard Python
>>>> library, if CodeSkulptor doesn't provide it, that's a serious bug.
>>>
>>>I think it's not a bug, but a restriction; since it's letting you run
>>>code on their server, and since Python sandboxing is a hard problem,
>>>CodeSkulptor cuts down the available modules. From the docs:
>>>
>>>http://www.codeskulptor.org/docs.html#tabs-Python

Excluding datetime seems rather extreme to me.


> BTW   Just read the instructions seems like a daunting task at the
> moment.  You knew what instructions you were looking for.  I am
> clueless.

So am I, because I don't know what instructions you're referring to.



-- 
Steven

[toc] | [prev] | [next] | [standalone]


#75656

FromChris Angelico <rosuav@gmail.com>
Date2014-08-04 13:09 +1000
Message-ID<mailman.12618.1407121789.18130.python-list@python.org>
In reply to#75654
On Mon, Aug 4, 2014 at 1:03 PM, Steven D'Aprano
<steve+comp.lang.python@pearwood.info> wrote:
>>>>I think it's not a bug, but a restriction; since it's letting you run
>>>>code on their server, and since Python sandboxing is a hard problem,
>>>>CodeSkulptor cuts down the available modules. From the docs:
>>>>
>>>>http://www.codeskulptor.org/docs.html#tabs-Python
>
> Excluding datetime seems rather extreme to me.

By the look of their docs, they've actually gone the other way: it's
not that they've excluded datetime, but that they've carefully vetted
a specific set of modules (and maybe not all functionality in them)
and that's all they support. In any case, I think that as soon as you
hit an ImportError on the sandbox, you should go and download Python
for your desktop and start working there.

(Idea, for anyone who runs a sandbox like that: Enumerate all packages
and modules in the stdlib, and create a little stub for each of them.
"import blahblah" will still produce ImportError, but "import
datetime" could report back "This interpreter is working with a small
subset of the Python standard library" rather than leaving us
wondering if there was some weird copy/paste error in the import line.
And yes, I did test for that.)

ChrisA

[toc] | [prev] | [next] | [standalone]


#75686

FromPeter Otten <__peter__@web.de>
Date2014-08-04 14:39 +0200
Message-ID<mailman.12638.1407155986.18130.python-list@python.org>
In reply to#75654
Chris Angelico wrote:

> On Mon, Aug 4, 2014 at 1:03 PM, Steven D'Aprano
> <steve+comp.lang.python@pearwood.info> wrote:
>>>>>I think it's not a bug, but a restriction; since it's letting you run
>>>>>code on their server, and since Python sandboxing is a hard problem,
>>>>>CodeSkulptor cuts down the available modules. From the docs:
>>>>>
>>>>>http://www.codeskulptor.org/docs.html#tabs-Python
>>
>> Excluding datetime seems rather extreme to me.
> 
> By the look of their docs, they've actually gone the other way: it's
> not that they've excluded datetime, but that they've carefully vetted
> a specific set of modules (and maybe not all functionality in them)
> and that's all they support. In any case, I think that as soon as you
> hit an ImportError on the sandbox, you should go and download Python
> for your desktop and start working there.
> 
> (Idea, for anyone who runs a sandbox like that: Enumerate all packages
> and modules in the stdlib, and create a little stub for each of them.
> "import blahblah" will still produce ImportError, but "import
> datetime" could report back "This interpreter is working with a small
> subset of the Python standard library" rather than leaving us
> wondering if there was some weird copy/paste error in the import line.
> And yes, I did test for that.)

All nice and dandy, but the site seems to use a Python implementation 
entirely written in javascript:

http://www.skulpt.org/

It's not a sandbox on the server, the code runs in your browser.

[toc] | [prev] | [next] | [standalone]


#75693

FromChris Angelico <rosuav@gmail.com>
Date2014-08-05 00:18 +1000
Message-ID<mailman.12644.1407161942.18130.python-list@python.org>
In reply to#75654
On Mon, Aug 4, 2014 at 10:39 PM, Peter Otten <__peter__@web.de> wrote:
>> (Idea, for anyone who runs a sandbox like that: Enumerate all packages
>> and modules in the stdlib, and create a little stub for each of them.
>> "import blahblah" will still produce ImportError, but "import
>> datetime" could report back "This interpreter is working with a small
>> subset of the Python standard library" rather than leaving us
>> wondering if there was some weird copy/paste error in the import line.
>> And yes, I did test for that.)
>
> All nice and dandy, but the site seems to use a Python implementation
> entirely written in javascript:
>
> http://www.skulpt.org/
>
> It's not a sandbox on the server, the code runs in your browser.

It still has to be cut down, at least as regards modules implemented in C.

ImportError: No module named decimal on line 1

So, same applies. Adding a bunch of stubs like "decimal.py" to say
"This has a subset of the Python standard library and does not provide
the decimal module" would be useful.

As that one seems to be hosted on github, I'll drop a tracker issue
down there with the suggestion.

ChrisA

[toc] | [prev] | [next] | [standalone]


#75655

FromChris Angelico <rosuav@gmail.com>
Date2014-08-04 13:05 +1000
Message-ID<mailman.12617.1407121558.18130.python-list@python.org>
In reply to#75652
On Mon, Aug 4, 2014 at 12:38 PM, Seymore4Head
<Seymore4Head@hotmail.invalid> wrote:
> BTW   Just read the instructions seems like a daunting task at the
> moment.  You knew what instructions you were looking for.  I am
> clueless.

Yeah, that's called experience :) Part of that experience is the
rather painful one of spending a good few dev hours trying to sandbox
Python inside a C++ process, only to find that the sandbox got busted
wide open pretty quickly as soon as I asked people to try to. (It was
in a safe environment, firewalled off from everything. It was
deliberately done as a security test... and the system failed so
spectacularly that we had to make a complete change to the core model,
among other things not using Python. Which made me sad. We had to go
with ECMAScript and its flaws.) But that means that I know straight
away what to look for.

This is why we have these kinds of mailing lists / newsgroups. Every
one of us has some experience; when you put a question out to the
collective, there's a high probability that someone will know the
answer. It's not that there are "smart people" and "dumb people", and
that dumb people ask questions that smart people answer; it's that the
whole group is smarter than any one of us. And then the answer gets
posted to the whole group, and we all become that bit smarter for it
:)

ChrisA

[toc] | [prev] | [next] | [standalone]


#75672

FromChris “Kwpolska” Warrick <kwpolska@gmail.com>
Date2014-08-04 10:26 +0200
Message-ID<mailman.12628.1407141948.18130.python-list@python.org>
In reply to#75649
On Mon, Aug 4, 2014 at 4:08 AM, Seymore4Head
<Seymore4Head@hotmail.invalid> wrote:
> I am just going to run 3.3 remotely.

Why and why?  3.3 is an old, outdated version — the most recent
version is v3.4.1.  By running 3.3 you are missing out on some new
features, and bugfixes.  You are better off running v3.4.1.

The other “why” refers to remotely running it on a Windows XP box.
This is a waste of time and resources. You are not going to save much
disk space, you can’t gain a thing, it’s not going to help: it will
just be a burden.  Especially because you’re running the remote box on
Windows (and an ancient version at that) — you are not running away
from all the issues of running in a Windows environment, and add
issues of running in a remote Windows environment.

Please stop, for your own good.

-- 
Chris “Kwpolska” Warrick <http://chriswarrick.com/>
PGP: 5EAAEA16
stop html mail | always bottom-post | only UTF-8 makes sense

[toc] | [prev] | [next] | [standalone]


#75646

FromSeymore4Head <Seymore4Head@Hotmail.invalid>
Date2014-08-03 21:41 -0400
Message-ID<1pott9lj8bidbfjv0rvc6i24kc5lm7jg91@4ax.com>
In reply to#75643
On Mon, 04 Aug 2014 11:29:06 +1000, Steven D'Aprano
<steve+comp.lang.python@pearwood.info> wrote:

>Seymore4Head wrote:
>
>[...]
>> The second thing I am doing is using codeskulptor to try out a few
>> things I have learned at codecademy.
>
>What's CodeSkulptor?
>
>> Putting that in codeskulptor gets
>> 
>> Line 4: ImportError: No module named datetime
>
>Well that's a bug in CodeSkultor. datetime is a standard Python library, if
>CodeSkulptor doesn't provide it, that's a serious bug.

Is codeskulptor only free to users of coursra?  I assumed that
codeskulptor was free to everyone.

Could you verify that datetime is not included in codeskulptor?
http://www.codeskulptor.org/

I just tried 3 simple lines of code at codeskulptor
import random
import math
import datetime

Line 3: ImportError: No module named datetime

I guess I should be using Python 3.3.

Thanks

[toc] | [prev] | [next] | [standalone]


#75647

FromMark Lawrence <breamoreboy@yahoo.co.uk>
Date2014-08-04 02:56 +0100
Message-ID<mailman.12612.1407117410.18130.python-list@python.org>
In reply to#75646
On 04/08/2014 02:41, Seymore4Head wrote:
> On Mon, 04 Aug 2014 11:29:06 +1000, Steven D'Aprano
> <steve+comp.lang.python@pearwood.info> wrote:
>
>> Seymore4Head wrote:
>>
>> [...]
>>> The second thing I am doing is using codeskulptor to try out a few
>>> things I have learned at codecademy.
>>
>> What's CodeSkulptor?
>>
>>> Putting that in codeskulptor gets
>>>
>>> Line 4: ImportError: No module named datetime
>>
>> Well that's a bug in CodeSkultor. datetime is a standard Python library, if
>> CodeSkulptor doesn't provide it, that's a serious bug.
>
> Is codeskulptor only free to users of coursra?  I assumed that
> codeskulptor was free to everyone.
>
> Could you verify that datetime is not included in codeskulptor?
> http://www.codeskulptor.org/
>
> I just tried 3 simple lines of code at codeskulptor
> import random
> import math
> import datetime
>
> Line 3: ImportError: No module named datetime
>
> I guess I should be using Python 3.3.
>
> Thanks
>

That won't do you any good at all, the datetime module has been around 
for years.  Try your favourite search engine for something like "free 
online python code tester", there's bound to be something to suit your 
needs.  Alternatively what's stopping you running Python on your own 
machine?

-- 
My fellow Pythonistas, ask not what our language can do for you, ask
what you can do for our language.

Mark Lawrence

[toc] | [prev] | [next] | [standalone]


#75648

FromSeymore4Head <Seymore4Head@Hotmail.invalid>
Date2014-08-03 22:07 -0400
Message-ID<8gqtt9heke2vrk4nl5rbb7lv2p141pm17g@4ax.com>
In reply to#75647
On Mon, 04 Aug 2014 02:56:34 +0100, Mark Lawrence
<breamoreboy@yahoo.co.uk> wrote:

>On 04/08/2014 02:41, Seymore4Head wrote:
>> On Mon, 04 Aug 2014 11:29:06 +1000, Steven D'Aprano
>> <steve+comp.lang.python@pearwood.info> wrote:
>>
>>> Seymore4Head wrote:
>>>
>>> [...]
>>>> The second thing I am doing is using codeskulptor to try out a few
>>>> things I have learned at codecademy.
>>>
>>> What's CodeSkulptor?
>>>
>>>> Putting that in codeskulptor gets
>>>>
>>>> Line 4: ImportError: No module named datetime
>>>
>>> Well that's a bug in CodeSkultor. datetime is a standard Python library, if
>>> CodeSkulptor doesn't provide it, that's a serious bug.
>>
>> Is codeskulptor only free to users of coursra?  I assumed that
>> codeskulptor was free to everyone.
>>
>> Could you verify that datetime is not included in codeskulptor?
>> http://www.codeskulptor.org/
>>
>> I just tried 3 simple lines of code at codeskulptor
>> import random
>> import math
>> import datetime
>>
>> Line 3: ImportError: No module named datetime
>>
>> I guess I should be using Python 3.3.
>>
>> Thanks
>>
>
>That won't do you any good at all, the datetime module has been around 
>for years.  Try your favourite search engine for something like "free 
>online python code tester", there's bound to be something to suit your 
>needs.  Alternatively what's stopping you running Python on your own 
>machine?

Well........it is just a small thing, but I am going to have to do it.

I run Win7 and like to keep it lean so I also have an XP machine that
I use for experimenting.   I log into the XP machine remotely.  I
don't like to have to keep it running 24/7 like I use to.  I guess I
will have to get over that, won't I?

Thanks

[toc] | [prev] | [next] | [standalone]


#75667

FromTerry Reedy <tjreedy@udel.edu>
Date2014-08-04 03:02 -0400
Message-ID<mailman.12623.1407135772.18130.python-list@python.org>
In reply to#75648
On 8/3/2014 10:07 PM, Seymore4Head wrote:

> I run Win7

Just get 3.4.1 and install it on win 7. works great.

>and like to keep it lean

Avoid 25 mb python install is more like keeping it anorexic ;-).

Python will not bite or squeeze your machine.

 > so I also have an XP machine that I use for experimenting.

xp is off of MS support, so it is going off of Python support too.


-- 
Terry Jan Reedy

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web