Re: [pystatsmodels] Minor 2to3 error?

42 views
Skip to first unread message

josef...@gmail.com

unread,
Jan 29, 2013, 9:34:12 AM1/29/13
to pystat...@googlegroups.com
On Tue, Jan 29, 2013 at 9:20 AM, dc <david.c...@gmail.com> wrote:
> For some reason some of the files in the sandbox are not getting 2to3'd by
> build_py_2to3 and is causing a minor error during "install".
>
> $ git grep "print ss.params"
> statsmodels/sandbox/nonparametric/tests/ex_gam_am_new.py: print ss.params
> statsmodels/sandbox/nonparametric/tests/ex_gam_new.py: print ss.params
>
> creating
> /usr/local/lib/python3.3/site-packages/statsmodels-0.5.0-py3.3-linux-x86_64.egg
> Extracting statsmodels-0.5.0-py3.3-linux-x86_64.egg to
> /usr/local/lib/python3.3/site-packages
> File
> "/usr/local/lib/python3.3/site-packages/statsmodels-0.5.0-py3.3-linux-x86_64.egg/statsmodels/sandbox/nonparametric/tests/ex_gam_am_new.py",
> line 59
> print ss.params
> ^
> SyntaxError: invalid syntax
>
> File
> "/usr/local/lib/python3.3/site-packages/statsmodels-0.5.0-py3.3-linux-x86_64.egg/statsmodels/sandbox/nonparametric/tests/ex_gam_new.py",
> line 52
> print "binomial"
> ^
> SyntaxError: invalid syntax
>
> File
> "/usr/local/lib/python3.3/site-packages/statsmodels-0.5.0-py3.3-linux-x86_64.egg/statsmodels/sandbox/nonparametric/tests/ex_smoothers.py",
> line 34
> print mse
> ^
> SyntaxError: invalid syntax
>
> statsmodels 0.5.0 is already the active version in easy-install.pth
>
> Installed
> /usr/local/lib/python3.3/site-packages/statsmodels-0.5.0-py3.3-linux-x86_64.egg
> Processing dependencies for statsmodels==0.5.0
> Finished processing dependencies for statsmodels==0.5.0

How did you install it?
and which version of statsmodels is this? master or dev build on github download

I installed master last weekend with ``setup.py install`` in python
3.3 and I have all these files with correct braces, print()

Josef


>
> --
> You received this message because you are subscribed to the Google Groups
> "pystatsmodels" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to pystatsmodel...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>

Vincent Arel

unread,
Jan 29, 2013, 9:40:41 AM1/29/13
to pystat...@googlegroups.com
I get the same problem with current master.

Vincent

josef...@gmail.com

unread,
Jan 29, 2013, 10:19:18 AM1/29/13
to pystat...@googlegroups.com
Ok, missing ``__init__.py`` in the directory.

I didn't realize my ``__init__.py`` is not in the repo. I need to
start testing from a clean checkout instead of one of my development
checkouts.

To clarify: What's the "minor error" during install?

The example folder also is not on the path and is not converted by
2to3. Ok, but's its not in the manifest.in and is not copied to the
install directory.

Looks like we need to make sure that every script or module that is
copied to the install is on the python path, or we need a separate
call to 2to3.

Thank you for reporting and checking.

Josef

>
> Vincent

Skipper Seabold

unread,
Jan 29, 2013, 10:54:07 AM1/29/13
to pystat...@googlegroups.com
I thought this was intentional? I'm not entirely clear on what you're proposing, but I'd still rather not install the examples. Can we just put a script in the examples folder (or wherever) that will run 2to3 over the code without adding it to setup.py / install. E.g., run_this_if_you_are_using_python3.py

Skipper
 
Josef

>
> Vincent
>
> --
> You received this message because you are subscribed to the Google Groups "pystatsmodels" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to pystatsmodel...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>

josef...@gmail.com

unread,
Jan 29, 2013, 11:12:41 AM1/29/13
to pystat...@googlegroups.com
That's a separate decision from the current case.

The folder is called tests and gets installed/copied. Not having an
__init__.py in a test folder is now a bug.
That there are 3 example scripts ex_xxx.py in the test folder (in the
sandbox) was a sloppyness on my part.

For the examples, I think, we can rewrite them in a way that they run
on py 2 and py 3 without changes and need for 2to3, see my recent
thread.

Josef

>
> Skipper
>
>>
>> Josef
>>
>> >
>> > Vincent
>> >
>> > --
>> > You received this message because you are subscribed to the Google
>> > Groups "pystatsmodels" group.
>> > To unsubscribe from this group and stop receiving emails from it, send
>> > an email to pystatsmodel...@googlegroups.com.
>> > For more options, visit https://groups.google.com/groups/opt_out.
>> >
>> >
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "pystatsmodels" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to pystatsmodel...@googlegroups.com.
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>>
>

Ralf Gommers

unread,
Jan 29, 2013, 3:16:50 PM1/29/13
to pystat...@googlegroups.com
That doesn't sound right. An alternative that doesn't require you to make a submodule you don't want to trick 2to3 is to use add_data_dir('tests') in setup.py files (see scipy setup.py's). Or a standalone script like Skipper says.

Ralf

josef...@gmail.com

unread,
Jan 29, 2013, 3:47:31 PM1/29/13
to pystat...@googlegroups.com
We decided quite some time ago that tests folders should be on the
python path. So all of them should be.

add_data_dir('tests') doesn't trigger a 2to3 conversion. It has been a
while since I looked into this, but IIRC, I tried this and it didn't
work.

BTW:
I compared some of our main model modules before and after 2to3 and
there are very few changes
(dot in imports, some extra list(...), and xrange -> range)
some of the other modules require more changes

Josef

>
> Ralf
Reply all
Reply to author
Forward
0 new messages