Re: [sqlalchemy] Importing module from another subdirectory [UPDATE 2]

2019-04-17 Thread Rich Shepard

On Wed, 17 Apr 2019, Rich Shepard wrote:


Getting closer. Added a blank __init.py__ in the models/ subdirectory. Now
I'm looking for the proper syntax to import the relevant class within that
module.



So more work on my part.


I'm moving this thread to the python mail list; it's a python issue not an
SA issue.

Trying to run the module using Python3-3.7.3's pdb I get the same error.

Rich

--
SQLAlchemy - 
The Python SQL Toolkit and Object Relational Mapper


http://www.sqlalchemy.org/

To post example code, please provide an MCVE: Minimal, Complete, and Verifiable 
Example.  See  http://stackoverflow.com/help/mcve for a full description.
--- 
You received this message because you are subscribed to the Google Groups "sqlalchemy" group.

To unsubscribe from this group and stop receiving emails from it, send an email 
to sqlalchemy+unsubscr...@googlegroups.com.
To post to this group, send email to sqlalchemy@googlegroups.com.
Visit this group at https://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.


Re: [sqlalchemy] Importing module from another subdirectory [UPDATE]

2019-04-17 Thread Rich Shepard

On Wed, 17 Apr 2019, Rich Shepard wrote:


What is the proper syntax to import models as m a in a view module, e.g.,
activities.py? The syntax, 'import model as m' fails because it is not in
the same subdirectory as the importing module.


Getting closer. Added a blank __init.py__ in the models/ subdirectory. Now
I'm looking for the proper syntax to import the relevant class within that
module.

import model.activities as a

is not working:
Traceback (most recent call last):
  File "activities_data_entry.py", line 1, in 
import model.activities as a
ModuleNotFoundError: No module named 'model'

So more work on my part.

Rich

--
SQLAlchemy - 
The Python SQL Toolkit and Object Relational Mapper


http://www.sqlalchemy.org/

To post example code, please provide an MCVE: Minimal, Complete, and Verifiable 
Example.  See  http://stackoverflow.com/help/mcve for a full description.
--- 
You received this message because you are subscribed to the Google Groups "sqlalchemy" group.

To unsubscribe from this group and stop receiving emails from it, send an email 
to sqlalchemy+unsubscr...@googlegroups.com.
To post to this group, send email to sqlalchemy@googlegroups.com.
Visit this group at https://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.


[sqlalchemy] Importing module from another subdirectory

2019-04-17 Thread Rich Shepard
My application intends to follow the MVC pattern. The model.py module is 
../model/model.py while the Tkinter views are in ../views/. Both are

relative to the application's main directory:

bustrac/
  README.rst
  bustrac.py*
  controller/
  images/
  model/
  scripts/
  views/

What is the proper syntax to import models as m a in a view module, e.g.,
activities.py? The syntax, 'import model as m' fails because it is not in
the same subdirectory as the importing module.

My previous use of python has had all files in the same directory so I've
not before had to learn how to address this issue. Pointers appreciated.

Regards,

Rich

--
SQLAlchemy - 
The Python SQL Toolkit and Object Relational Mapper


http://www.sqlalchemy.org/

To post example code, please provide an MCVE: Minimal, Complete, and Verifiable 
Example.  See  http://stackoverflow.com/help/mcve for a full description.
--- 
You received this message because you are subscribed to the Google Groups "sqlalchemy" group.

To unsubscribe from this group and stop receiving emails from it, send an email 
to sqlalchemy+unsubscr...@googlegroups.com.
To post to this group, send email to sqlalchemy@googlegroups.com.
Visit this group at https://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.