Search Results
|
Post |
Author |
Forum |
Replies |
Views |
Posted
[asc]
|
|
|
Thread: When I import a Module it wont run
Post: RE: When I import a Module it wont run
Sorry for the late reply. Ive been away from my laptop for almost 2 weeks.
Thanks to all who helped me out. I appreciate you taking the time to help out.
The code now works. Ive added each Module be... |
|
PyNovice |
General Coding Help |
17 |
6,378 |
Oct-26-2019, 11:14 AM |
|
|
Thread: When I import a Module it wont run
Post: RE: When I import a Module it wont run
(Oct-14-2019, 03:28 PM)buran Wrote: you still don't get it. let's break the code in post 12
lines 1-2: here you import necessary modules. you want this part to be executed always (i.e. when import ... |
|
PyNovice |
General Coding Help |
17 |
6,378 |
Oct-14-2019, 04:33 PM |
|
|
Thread: When I import a Module it wont run
Post: RE: When I import a Module it wont run
(Oct-14-2019, 12:45 PM)ichabod801 Wrote: (Oct-14-2019, 12:23 PM)PyNovice Wrote: Ive just tried it this way
No, you didn't try it that way. What I suggested was this:
def foo():
print(bar)
i... |
|
PyNovice |
General Coding Help |
17 |
6,378 |
Oct-14-2019, 12:57 PM |
|
|
Thread: When I import a Module it wont run
Post: RE: When I import a Module it wont run
I posted previously without reading your reply.
This is what Ive now done
import os
import globalVariables as gv
def listCWD():
""" This section lists everything in the current working directory
... |
|
PyNovice |
General Coding Help |
17 |
6,378 |
Oct-14-2019, 12:39 PM |
|
|
Thread: When I import a Module it wont run
Post: RE: When I import a Module it wont run
Ive just tried it this way but I get the error message at the bottom of the page when I run the returnFileList.py Module.
import os
import globalVariables as gv
if __name__ == '__main__':
def lis... |
|
PyNovice |
General Coding Help |
17 |
6,378 |
Oct-14-2019, 12:23 PM |
|
|
Thread: When I import a Module it wont run
Post: RE: When I import a Module it wont run
(Sep-23-2019, 01:06 AM)ichabod801 Wrote: First of all, that is not the correct code or you would be getting an indentation error. Second, the if __name__ goes at the end of the file, and is only for... |
|
PyNovice |
General Coding Help |
17 |
6,378 |
Oct-14-2019, 12:06 PM |
|
|
Thread: When I import a Module it wont run
Post: RE: When I import a Module it wont run
(Sep-23-2019, 01:06 AM)ichabod801 Wrote: First of all, that is not the correct code or you would be getting an indentation error. Second, the if __name__ goes at the end of the file, and is only for... |
|
PyNovice |
General Coding Help |
17 |
6,378 |
Sep-23-2019, 08:48 AM |
|
|
Thread: When I import a Module it wont run
Post: RE: When I import a Module it wont run
(Sep-22-2019, 06:59 PM)ichabod801 Wrote: Okay, but the module seems to be importing correctly, so this seems to be a problem with the listCWD function.
Here is the code in the listCWD.py file
import... |
|
PyNovice |
General Coding Help |
17 |
6,378 |
Sep-22-2019, 07:09 PM |
|
|
Thread: When I import a Module it wont run
Post: RE: When I import a Module it wont run
(Sep-22-2019, 06:32 PM)ichabod801 Wrote: If the listCWD function definition is not in the if __name__ block, you should be able to run it like this:
import listCWD
whatever = listCWD.listCWD()Remem... |
|
PyNovice |
General Coding Help |
17 |
6,378 |
Sep-22-2019, 06:57 PM |
|
|
Thread: When I import a Module it wont run
Post: When I import a Module it wont run
Hello, I have 4 files. They are:
globalVariables.py - this stores variables that are used in other modules
returnCWD.py - this has a function that returns the current working directory
list... |
|
PyNovice |
General Coding Help |
17 |
6,378 |
Sep-22-2019, 06:30 PM |
|
|
Thread: Can anyone recommend a step by step guide to building an app
Post: RE: Can anyone recommend a step by step guide to b...
(Sep-15-2019, 12:46 PM)ndc85430 Wrote: If you learn about writing automated tests (e.g. unit tests), then test-driven development is a great way to go about building software incrementally.
Thanks f... |
|
PyNovice |
News and Discussions |
9 |
3,893 |
Sep-16-2019, 03:53 PM |
|
|
Thread: Can anyone recommend a step by step guide to building an app
Post: RE: Can anyone recommend a step by step guide to b...
(Sep-14-2019, 03:34 PM)snippsat Wrote: Start bye looking at virtual environment and packaging at basic level.
I have several post about this,can link to some here, here, here, here.
In this tutorial... |
|
PyNovice |
News and Discussions |
9 |
3,893 |
Sep-15-2019, 08:44 AM |
|
|
Thread: Can anyone recommend a step by step guide to building an app
Post: RE: Can anyone recommend a step by step guide to b...
@metulburr Thank you
When you are creating an app is there a process that you use.
Atm i am writing code but I have no structure or overall plan to work to.
For example when creating a Database the... |
|
PyNovice |
News and Discussions |
9 |
3,893 |
Sep-14-2019, 10:41 AM |
|
|
Thread: Can anyone recommend a step by step guide to building an app
Post: RE: Can anyone recommend a step by step guide to b...
(Sep-14-2019, 03:22 AM)Larz60+ Wrote: If you look through here: http://openbookproject.net/thinkcs/pytho...tions.html
you'll find a bunch of examples, with explanations, and then finally the complet... |
|
PyNovice |
News and Discussions |
9 |
3,893 |
Sep-14-2019, 10:29 AM |
|
|
Thread: Can anyone recommend a step by step guide to building an app
Post: Can anyone recommend a step by step guide to build...
Hello all,
this is my first post.
I'm studying for the Microsoft MTA in Python Fundamentals.
The course covers the basics but does not teach you how to create an app from start to finish
... |
|
PyNovice |
News and Discussions |
9 |
3,893 |
Sep-13-2019, 04:13 PM |