how to change a variable from a module inside a module in a module… (confused)


I have a variable in my main module which is changed using another
module, but I want to change the variable from my main module through
another module. I'm new to programmering, so I actually don't really
know how to explain this stuff - sorry if I'm asking a stupid
question.


The program's hierarchy looks a bit like
this:


Main

---Features />
---Pygame_handling

------Features


I use the
"Features" module to change a variable in the "Main". I do this simply
by getting the defined variable from "Features". But when I change the
variable through "Pygame_handling", it is not changed in the
"Features" object

I'm new to Python and am using it only to get a third-party module
running. It's quite a specialized application (and available at
https://github.com/patvarilly/DNACC) but I guess that my problem is
more generic.


I installed Python 2.7.3 (32-bit) along with
NumPy 1.6.1, SciPy 0.11.0 and Visual C++ 2008 Express on a Windows 7
64-bit system. I then unzipped DNACC into the site-packages subfolder
and executed "setup.py install" from the DOS shell (as an
Administrator). This is the error message I got in response:



Traceback (most recent call last):



File
"C:Python27Libsite-packagesDNACC-mastersetup.py", line 166, in

Operating Systems

I have a package with two modules in it. One is the
__init__ file, and the other is a separate part of the
package. If I try from mypackage import separatepart, the
code in the __init__ module is run, which will run
unneeded code, slowing down the importing by a lot. The code in
separate part won't cause any errors, and so users should be able to
directly import it without importing the __init__ module.


Since I can't figure out a way to do this, I thought I
should include a function in the __init__ file that does
everything so nothing would be done directly, but in order to do this,
I would need to have

Programming Languages

I use Commander.js in my Node.js module, the problem I'm
experiencing is when a 3rd party Node.js script includes my module and
also wants to use Commander.js, my specified parameters show up but
theirs don't. Is there a way that both of our parameters can work
together?


The background story is I have a Node.js module
that displays debug information to the user when they run their
script, but when they run the script in production they don't want
this information outputted so they run it with:


node
script.js --production
Programming Languages

Suppose I have a package named bar, and it contains bar.py:

/>a = None
def foobar():
print a
/>

and __init__.py:


from bar import a, foobar />

Then I execute this script:


import
bar
print bar.a
bar.a = 1
print bar.a />bar.foobar()

Here's what I expect:

/>None
1
1

Here's what I
get:


None
1
None

Can
anyone explain my misconception?

Programming Languages

I have a variable in my main module which is changed using another
module, but I want to change the variable from my main module through
another module. I'm new to programmering, so I actually don't really
know how to explain this stuff - sorry if I'm asking a stupid
question.


The program's hierarchy looks a bit like
this:


Main

---Features />
---Pygame_handling

------Features


I use the
"Features" module to change a variable in the "Main". I do this simply
by getting the defined variable from "Features". But when I change the
variable through "Pygame_handling", it is not changed in the
"Features" object

Programming Languages

I have a local module named tokenize.py, masks a
standard library module of the same name. I only discovered this when
I tried to import an external module (sklearn.linear_model), which in
turn does import tokenize and expects to get the standard
library module, but gets my local module instead.


This is
related to How to access a standard-library module in Python when
there is a local module with the same name?, but the setting is
different, because applying the above solution would require modifying
the external module.


An option would be to rename the
local tokenize.py, but I would prefer not to do so as
"tok

Programming Languages

- Technology - Languages
+ Webmasters
+ Development
+ Development Tools
+ Internet
+ Mobile Programming
+ Linux
+ Unix
+ Apple
+ Ubuntu
+ Mobile & Tablets
+ Databases
+ Android
+ Network & Servers
+ Operating Systems
+ Coding
+ Design Software
+ Web Development
+ Game Development
+ Access
+ Excel
+ Web Design
+ Web Hosting
+ Web Site Reviews
+ Domain Name
+ Information Security
+ Software
+ Computers
+ Electronics
+ Hardware
+ Windows
+ PHP
+ ASP/ASP.Net
+ C/C++/C#
+ VB/VB.Net
+ JAVA
+ Javascript
+ Programming
Privacy Policy - Copyrights Notice - Feedback - Report Violation 2018 © BigHow