Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Got "ValueError: Attempted relative import in non-package" when use ropemacs.
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  3 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Oleksandr Gavenko (aka gavenkoa)  
View profile  
 More options Feb 29 2012, 1:24 pm
From: "Oleksandr Gavenko (aka gavenkoa)" <gaven...@gmail.com>
Date: Wed, 29 Feb 2012 10:24:19 -0800 (PST)
Local: Wed, Feb 29 2012 1:24 pm
Subject: Got "ValueError: Attempted relative import in non-package" when use ropemacs.
Originally i ask this question at:

  http://permalink.gmane.org/gmane.emacs.help/83894

When all my code stay in single file - all ok. But when come time to
split
code to several files I get error:

  ValueError: Attempted relative import in non-package

in *Python* buffer when visit Python file which use relative import:

  from .blogger import *
  from .wordpress import *

File hierarchy:

  <root>/blog4y/blog4y.py
  <root>/blog4y/blogger.py
  <root>/blog4y/wordpress.py

Note that my application:

  #!/usr/bin/env python
  from blog4y import blog4y
  blog4y.start()

work fine when called from <root> directory...

I am newbie for Python and rope. I think that solution lie in
customising
<root>/blog4y/blog4y/.ropeproject/config.py file...

I read:

  http://rope.sourceforge.net/ropemacs.html
  http://pymacs.progiciels-bpi.ca/pymacs.html#pymacs-load-path

but have no idea how to fix issue...


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Ali Gholami Rudi  
View profile  
 More options Feb 29 2012, 2:29 pm
From: Ali Gholami Rudi <aligr...@gmail.com>
Date: Wed, 29 Feb 2012 22:59:17 +0330
Local: Wed, Feb 29 2012 2:29 pm
Subject: Re: Got "ValueError: Attempted relative import in non-package" when use ropemacs.
Hi,

"Oleksandr Gavenko (aka gavenkoa)" <gaven...@gmail.com> wrote:

> Originally i ask this question at:

>   http://permalink.gmane.org/gmane.emacs.help/83894

> When all my code stay in single file - all ok. But when come time to
> split
> code to several files I get error:

>   ValueError: Attempted relative import in non-package

This does not seem to be a ropemacs error.  As the error says, you are
doing a relative import outside a package; probably a script (python
xyz.py) or the interactive python prompt.

> in *Python* buffer when visit Python file which use relative import:

>   from .blogger import *
>   from .wordpress import *

Relative imports don't work in the interactive python shell, as far as
I can say.

        Ali


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Oleksandr Gavenko  
View profile  
 More options Feb 29 2012, 3:34 pm
From: Oleksandr Gavenko <gaven...@gmail.com>
Date: Wed, 29 Feb 2012 22:34:35 +0200
Local: Wed, Feb 29 2012 3:34 pm
Subject: Re: Got "ValueError: Attempted relative import in non-package" when use ropemacs.
On 2012-02-29, Ali Gholami Rudi wrote:

> "Oleksandr Gavenko (aka gavenkoa)" <gaven...@gmail.com> wrote:
>> Originally i ask this question at:

>>   http://permalink.gmane.org/gmane.emacs.help/83894

>> When all my code stay in single file - all ok. But when come time to
>> split
>> code to several files I get error:

>>   ValueError: Attempted relative import in non-package

> This does not seem to be a ropemacs error.  As the error says, you are
> doing a relative import outside a package; probably a script (python
> xyz.py) or the interactive python prompt.

Ok, I agree that this is not rope problem... I type C-c C-c and get error in
*Python* buffer:

  >>> Traceback (most recent call last):
    File "/tmp/py4140IWr", line 5, in <module>
      from .blogger import *
  ValueError: Attempted relative import in non-package

But among other question have some that relative to ropemacs...

I have such project structure:

  <root>/blog4y-cli
  <root>/blog4y/blog4y.py
  <root>/blog4y/blogger.py
  <root>/blog4y/wordpress.py

and blog4y.py must import blogger.py and wordpress.py.

Emacs create <root>/blog4y/.ropeproject/config.py and
<root>/blog4y/.ropeproject/objectdb files.

Is that right path for .ropeproject?

How to tell to ropemacs that under <root>/blog4y/ live 'blog4y' package with 3
modules inside?

Another question is how to tell to ropemacs to reload file that I edit?
"M-x revert-buffer" or ropemacs automatically detect buffer saving?

--
Best regards!


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »