"NameError: global name 'time' is not defined" and a solution

3,348 views
Skip to first unread message

Wise-Man

unread,
Nov 4, 2010, 7:17:56 AM11/4/10
to play-framework
Hi Guys

I got an error while trying to "netbeansify" my application. I am
running on Windows XP with Play 1.1.

$ play netbeansify myApp
~ _ _
~ _ __ | | __ _ _ _| |
~ | '_ \| |/ _' | || |_|
~ | __/|_|\____|\__ (_)
~ |_| |__/
~
~ play! 1.1, http://www.playframework.org
~
Traceback (most recent call last):
File "D:\Play!Framework\play-1.1\play", line 111, in <module>
cmdloader.commands[play_command].execute(command=play_command,
app=play_app, args=remaining_args, env=play_env, cmdloader=cmdloader)
File "d:\Play!Framework\play-1.1\framework\pym\play\commands
\netbeans.py", line 28, in execute
time.sleep(1)
NameError: global name 'time' is not defined

I googled the problem and end up in python forum where they suggested
to replace "time.sleep(1)" with "sleep(1)". I went to netbeans.py and
did the change. solution worked.

maybe this fix should be introduced in the next release.

Regards

Erwan Loisant

unread,
Nov 4, 2010, 7:25:01 AM11/4/10
to play-fr...@googlegroups.com
What version of Python are you using?

> --
> You received this message because you are subscribed to the Google Groups "play-framework" group.
> To post to this group, send email to play-fr...@googlegroups.com.
> To unsubscribe from this group, send email to play-framewor...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/play-framework?hl=en.
>
>

--
Erwan Loisant

Erwan Loisant

unread,
Nov 4, 2010, 7:26:44 AM11/4/10
to play-fr...@googlegroups.com
Oh, I see the error, an import time is missing (but only for Windows
which is why I couldn't see it). Feel free to fill a bug, that'll be
fixed soon.

--
Erwan Loisant

Wise-Man

unread,
Nov 6, 2010, 4:44:49 AM11/6/10
to play-framework
I will do that

On 4 نوفمبر, 15:26, Erwan Loisant <elois...@gmail.com> wrote:
> Oh, I see the error, an import time is missing (but only for Windows
> which is why I couldn't see it). Feel free to fill a bug, that'll be
> fixed soon.
>
>
>
>
>
>
>
>
>
> On Thu, Nov 4, 2010 at 12:25, Erwan Loisant <elois...@gmail.com> wrote:
> > What version of Python are you using?
>
> > On Thu, Nov 4, 2010 at 12:17, Wise-Man <mohd...@gmail.com> wrote:
> >> Hi Guys
>
> >> I got an error while trying to "netbeansify" my application. I am
> >> running on Windows XP with Play 1.1.
>
> >> $ play netbeansify myApp
> >> ~        _            _
> >> ~  _ __ | | __ _ _  _| |
> >> ~ | '_ \| |/ _' | || |_|
> >> ~ |  __/|_|\____|\__ (_)
> >> ~ |_|            |__/
> >> ~
> >> ~ play! 1.1,http://www.playframework.org
> >> ~
> >> Traceback (most recent call last):
> >>  File "D:\Play!Framework\play-1.1\play", line 111, in <module>
> >>    cmdloader.commands[play_command].execute(command=play_command,
> >> app=play_app, args=remaining_args, env=play_env, cmdloader=cmdloader)
> >>  File "d:\Play!Framework\play-1.1\framework\pym\play\commands
> >> \netbeans.py", line 28, in execute
> >>    time.sleep(1)
> >> NameError: global name 'time' is not defined
>
> >> I googled the problem and end up in python forum where they suggested
> >> to replace "time.sleep(1)" with "sleep(1)". I went to netbeans.py and
> >> did the change. solution worked.
>
> >> maybe this fix should be introduced in the next release.
>
> >> Regards
>
> >> --
> >> You received this message because you are subscribed to the Google Groups "play-framework" group.
> >> To post to this group, send email to play-fr...@googlegroups.com.
> >> To unsubscribe from this group, send email to play-framewor...@googlegroups.com.
> >> For more options, visit this group athttp://groups.google.com/group/play-framework?hl=en.

JaKi

unread,
Dec 21, 2010, 9:35:14 AM12/21/10
to play-framework
Dear All,


I found another solution (because the previous fix didn't work for
me):

1. Open the /framework/pym/play/commands/netbeans.py (inside the Play!
Framework basedir)
2. Insert the following line to the beginning of the file:
import time


Best regards,
Szilard Jakab

Erwan Loisant

unread,
Dec 21, 2010, 9:47:06 AM12/21/10
to play-fr...@googlegroups.com
Well, the previous fix is exactly that. It's fixed in github (both
master and 1.1.x) so as soon as we release a new version it will be in
the stable version.

Reply all
Reply to author
Forward
0 new messages