Hy!
I'm new in Linux, and i feel little less newer in python.
I need advice and help. I'm making an application witch purpose is
irrelevant. It has a lot of code for now and I've only made interface.
So I've tried to split code into separate files and in windows as I
remember worked file when i wrote eg. import myFile but now in Ubuntu
it says Module not found. (I'm using Ubuntu and I've installed python
2.5 and wxPython 2.8.4, and I'm using GedIt as my favorite text editor).
The question is how to make this work (files are in the same folder)
Second question is about import wx. When i separate code into files i
have to write import wx into every file because all of them contains
some part of the interface. Does that make my program bigger than
putting everything into one file and use only one import.
Thanks in advance. 3 12299
On Dec 14, 3:44 pm, SMALLp <po...@email. t-com.hrwrote:
Hy!
I'm new in Linux, and i feel little less newer in python.
I need advice and help. I'm making an application witch purpose is
irrelevant. It has a lot of code for now and I've only made interface.
So I've tried to split code into separate files and in windows as I
remember worked file when i wrote eg. import myFile but now in Ubuntu
it says Module not found. (I'm using Ubuntu and I've installed python
2.5 and wxPython 2.8.4, and I'm using GedIt as my favorite text editor).
The question is how to make this work (files are in the same folder)
Not sure what is going on here from this description. You may need to
use the sys module and add the path to your module temporarily.
import sys
sys.path.append ("//path/to/myFile")
Second question is about import wx. When i separate code into files i
have to write import wx into every file because all of them contains
some part of the interface. Does that make my program bigger than
putting everything into one file and use only one import.
Thanks in advance.
No, importing wx in multiple files does not make it bigger. In fact,
as I understand it, Python will only import a module if it's not
already in the namespace. So if you import wx in your main module and
then import it again in some sub-module of yours, Python won't
actually import wx the second time, but will just use the one that's
in the namespace already.
See this thread for a more coherent explanation: http://mail.python.org/pipermail/pyt...er/293861.html
Mike ky******@gmail. com wrote:
On Dec 14, 3:44 pm, SMALLp <po...@email. t-com.hrwrote:
>Hy! I'm new in Linux, and i feel little less newer in python.
I need advice and help. I'm making an application witch purpose is irrelevant. It has a lot of code for now and I've only made interface. So I've tried to split code into separate files and in windows as I remember worked file when i wrote eg. import myFile but now in Ubuntu it says Module not found. (I'm using Ubuntu and I've installed python 2.5 and wxPython 2.8.4, and I'm using GedIt as my favorite text editor). The question is how to make this work (files are in the same folder)
Not sure what is going on here from this description. You may need to
use the sys module and add the path to your module temporarily.
import sys
sys.path.append ("//path/to/myFile")
I managed to make simple thing complicated. So what i was trying to do
is to write part of my program in a separate file and than use "import
myFile as my" to use classes written in that file.
Thanks for the answer Mike!
SMALLp wrote:
remember worked file when i wrote eg. import myFile but now in
Ubuntu it says Module not found. (I'm using Ubuntu and I've
installed python 2.5 and wxPython 2.8.4, and I'm using GedIt as my
favorite text editor). The question is how to make this work
(files are in the same folder)
Please provide the exact error message, the part of the source code
it refers to, and the command line you called the file by.
Second question is about import wx. When i separate code into
files i have to write import wx into every file because all of
them contains some part of the interface. Does that make my
program bigger than putting everything into one file and use only
one import.
Yes, the program gets a few bytes (11 for "import wx\r\n") bigger.
No, it is no performance problem.
Regards,
Björn
--
BOFH excuse #399:
We are a 100% Microsoft Shop. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Stephen Ferg |
last post by:
I need a little help here.
I'm developing some introductory material on Python for non-programmers.
The first draft includes this statement. Is this correct?
-----------------------------------------------------------------
When loading modules, Python looks for modules
in the following places in the following order:
|
by: svilen |
last post by:
hello again.
i'm now into using python instead of another language(s) for
describing structures of data, including names, structure,
type-checks, conversions, value-validations, metadata etc. And i have
things to offer, and to request.
And a lot of ideas, but who needs them....
here's an example (from type_struct.py):
|
by: Peter Schwalm |
last post by:
I'd like to modify the python search path depending on the source
directory of the script being started. The reason is: I use a version
control system, and the python scripts and modules are migrated
through several stages before they are used in production. A python
script running in a development environment should use different
modules - possibly in other directories then the script source
directory - than the same script running in a...
|
by: fuzzyman |
last post by:
I've hacked together a 'GoogleCacheServer'. It is based on
SimpleHTTPServer. Run the following script (hopefully google groups
won't mangle the indentation) and set your browser proxy settings to
'localhost:8000'. It will let you browse the internet using google's
cache. Obviously you'll miss images, javascript, css files, etc.
See the world as google sees it !
(This is actually an 'inventive' short term measure to get round a...
|
by: TokiDoki |
last post by:
Hello there,
I have been programming python for a little while, now. But as I am
beginning to do more complex stuff, I am running into small organization
problems.
It is possible that what I want to obtain is not possible, but I would
like the advice of more experienced python programmers.
I am writing a relatively complex program in python that has now around
40 files.
| |
by: Jay |
last post by:
OK, I have this XML doc, i dont know much about XML, but what i want
to do is take certain parts of the XML doc, such as </title> blah
</title> and take just that and put onto a text doc. Then same thing
doe the </body> part. Thats about it, i checked out some of the xml
modules but dont understand how to use them. Dont get parsing, so if
you could please explain working with XML and python to me. Email me at
jmailone@gmail.com
Aim-...
|
by: KraftDiner |
last post by:
I have a class that is defined in a file called MyClass.py
How do I use that class in another python script..
import MyClass ? (Does it need to be in a specific location?)
|
by: Kurt B. Kaiser |
last post by:
Patch / Bug Summary
___________________
Patches : 342 open (-38) / 3712 closed (+54) / 4054 total (+16)
Bugs : 951 open (-14) / 6588 closed (+33) / 7539 total (+19)
RFE : 257 open (-15) / 266 closed (+13) / 523 total ( -2)
New / Reopened Patches
______________________
|
by: david |
last post by:
You learn something new every day:
On my ubuntu, update-manager is supposed to use the python2.5
installed on /usr/bin. Well, I had subsequently installed a whole
bunch of stuff in /usr/local (/usr/local/bin/python and /usr/local/lib/
python2.5 etc), which I have happily been using for development for a
year. I had thought that the two pythons were completely independent.
Well, I was wrong. When /usr/bin/python2.5 runs, *by default*,...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |